pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1857932 - /pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java
Date Mon, 22 Apr 2019 00:23:23 GMT
Author: tilman
Date: Mon Apr 22 00:23:23 2019
New Revision: 1857932

URL: http://svn.apache.org/viewvc?rev=1857932&view=rev
Log:
PDFBOX-4017: SonarQube fix

Modified:
    pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java

Modified: pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java?rev=1857932&r1=1857931&r2=1857932&view=diff
==============================================================================
--- pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java
(original)
+++ pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java
Mon Apr 22 00:23:23 2019
@@ -584,42 +584,39 @@ public class PDType1Font extends PDSimpl
         {
             return name;
         }
-        else
+
+        // try alternative name
+        String altName = ALT_NAMES.get(name);
+        if (altName != null && !name.equals(".notdef") && genericFont.hasGlyph(altName))
         {
-            // try alternative name
-            String altName = ALT_NAMES.get(name);
-            if (altName != null && !name.equals(".notdef") && genericFont.hasGlyph(altName))
+            return altName;
+        }
+
+        // try unicode name
+        String unicodes = getGlyphList().toUnicode(name);
+        if (unicodes != null && unicodes.length() == 1)
+        {
+            String uniName = getUniNameOfCodePoint(unicodes.codePointAt(0));
+            if (genericFont.hasGlyph(uniName))
             {
-                return altName;
+                return uniName;
             }
-            else
+            // PDFBOX-4017: no postscript table on Windows 10, and the low uni00NN
+            // names are not found. What works is using the PDF code plus 0xF000
+            // while disregarding encoding from the PDF (because of file from PDFBOX-1606,
+            // makes sense because this segment is about finding the name in a standard font)
+            //TODO bring up better solution than this
+            if ("SymbolMT".equals(genericFont.getName()))
             {
-                // try unicode name
-                String unicodes = getGlyphList().toUnicode(name);
-                if (unicodes != null && unicodes.length() == 1)
+                int code = SymbolEncoding.INSTANCE.getNameToCodeMap().get(name);
+                uniName = getUniNameOfCodePoint(code + 0xF000);
+                if (genericFont.hasGlyph(uniName))
                 {
-                    String uniName = getUniNameOfCodePoint(unicodes.codePointAt(0));
-                    if (genericFont.hasGlyph(uniName))
-                    {
-                        return uniName;
-                    }
-                    // PDFBOX-4017: no postscript table on Windows 10, and the low uni00NN
-                    // names are not found. What works is using the PDF code plus 0xF000
-                    // while disregarding encoding from the PDF (because of file from PDFBOX-1606;
-                    // makes sense because this segment is about finding the name in a standard
font)
-                    //TODO bring up better solution than this
-                    if ("SymbolMT".equals(genericFont.getName()))
-                    {
-                        int code = SymbolEncoding.INSTANCE.getNameToCodeMap().get(name);
-                        uniName = getUniNameOfCodePoint(code + 0xF000);
-                        if (genericFont.hasGlyph(uniName))
-                        {
-                            return uniName;
-                        }
-                    }
+                    return uniName;
                 }
             }
         }
+
         return ".notdef";
     }
 



Mime
View raw message