pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jahew...@apache.org
Subject svn commit: r1694856 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFont.java
Date Sun, 09 Aug 2015 07:00:13 GMT
Author: jahewson
Date: Sun Aug  9 07:00:13 2015
New Revision: 1694856

URL: http://svn.apache.org/r1694856
Log:
PDFBOX-2846: Try to find glyphs by unicode name if standard name doesn't work

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

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFont.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFont.java?rev=1694856&r1=1694855&r2=1694856&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFont.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFont.java Sun
Aug  9 07:00:13 2015
@@ -354,8 +354,13 @@ public class PDTrueTypeFont extends PDSi
 
             if (!ttf.hasGlyph(name))
             {
-                throw new IllegalArgumentException(
-                    String.format("No glyph for U+%04X in font %s", unicode, getName()));
+                // try unicode name
+                String uniName = String.format("uni%04X", unicode);
+                if (!ttf.hasGlyph(uniName))
+                {
+                    throw new IllegalArgumentException(
+                            String.format("No glyph for U+%04X in font %s", unicode, getName()));
+                }
             }
 
             int code = inverted.get(name);



Mime
View raw message