pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1832112 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType3Font.java
Date Wed, 23 May 2018 17:16:15 GMT
Author: tilman
Date: Wed May 23 17:16:15 2018
New Revision: 1832112

URL: http://svn.apache.org/viewvc?rev=1832112&view=rev
Log:
PDFBOX-4228: fix ClassCastException and bug that prevented the use of a name for encoding
in type3 fonts, by Daniel Persson

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

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType3Font.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType3Font.java?rev=1832112&r1=1832111&r2=1832112&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType3Font.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType3Font.java Wed
May 23 17:16:15 2018
@@ -75,8 +75,20 @@ public class PDType3Font extends PDSimpl
     @Override
     protected final void readEncoding() throws IOException
     {
-        COSDictionary encodingDict = (COSDictionary)dict.getDictionaryObject(COSName.ENCODING);
-        encoding = new DictionaryEncoding(encodingDict);
+        COSBase encodingBase = dict.getDictionaryObject(COSName.ENCODING);
+        if (encodingBase instanceof COSName)
+        {
+            COSName encodingName = (COSName) encodingBase;
+            encoding = Encoding.getInstance(encodingName);
+            if (encoding == null)
+            {
+                LOG.warn("Unknown encoding: " + encodingName.getName());
+            }
+        }
+        else if (encodingBase instanceof COSDictionary)
+        {
+            encoding = new DictionaryEncoding((COSDictionary) encodingBase);
+        }
         glyphList = GlyphList.getAdobeGlyphList();
     }
     



Mime
View raw message