pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1812415 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFont.java
Date Tue, 17 Oct 2017 15:14:30 GMT
Author: tilman
Date: Tue Oct 17 15:14:30 2017
New Revision: 1812415

URL: http://svn.apache.org/viewvc?rev=1812415&view=rev
Log:
PDFBOX-3965: add fallback for bogus "symbol" fonts

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFont.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFont.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFont.java?rev=1812415&r1=1812414&r2=1812415&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFont.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFont.java
Tue Oct 17 15:14:30 2017
@@ -625,6 +625,22 @@ public class PDTrueTypeFont extends PDSi
             {
                 gid = cmapMacRoman.getGlyphId(code);
             }
+
+            // PDFBOX-3965: fallback for font has that the symbol flag but isn't
+            if (gid == 0 && cmapWinUnicode != null && encoding != null)
+            {
+                String name = encoding.getName(code);
+                if (".notdef".equals(name))
+                {
+                    return 0;
+                }
+                String unicode = GlyphList.getAdobeGlyphList().toUnicode(name);
+                if (unicode != null)
+                {
+                    int uni = unicode.codePointAt(0);
+                    gid = cmapWinUnicode.getGlyphId(uni);
+                }
+            }            
         }
 
         return gid;



Mime
View raw message