You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2018/02/16 06:36:24 UTC

svn commit: r1824419 - /pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java

Author: tilman
Date: Fri Feb 16 06:36:24 2018
New Revision: 1824419

URL: http://svn.apache.org/viewvc?rev=1824419&view=rev
Log:
PDFBOX-4106: refactor to extract assignment

Modified:
    pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java

Modified: pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java?rev=1824419&r1=1824418&r2=1824419&view=diff
==============================================================================
--- pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java (original)
+++ pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java Fri Feb 16 06:36:24 2018
@@ -324,16 +324,14 @@ public class GlyphSubstitutionTable exte
                     || (OpenTypeScript.TAG_DEFAULT.equals(tag) && !scriptList.containsKey(tag)))
             {
                 // We don't know what script this should be.
-                if (lastUsedSupportedScript != null)
-                {
-                    // Use past context
-                    return lastUsedSupportedScript;
-                }
-                else
+                if (lastUsedSupportedScript == null)
                 {
                     // We have no past context and (currently) no way to get future context so we guess.
-                    return lastUsedSupportedScript = scriptList.keySet().iterator().next();
+                    lastUsedSupportedScript = scriptList.keySet().iterator().next();
                 }
+                // else use past context
+
+                return lastUsedSupportedScript;
             }
         }
         for (String tag : tags)
@@ -342,7 +340,8 @@ public class GlyphSubstitutionTable exte
             {
                 // Use the first recognized tag. We assume a single font only recognizes one version ("ver. 2")
                 // of a single script, or if it recognizes more than one that it prefers the latest one.
-                return lastUsedSupportedScript = tag;
+                lastUsedSupportedScript = tag;
+                return lastUsedSupportedScript;
             }
         }
         return tags[0];