You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2021/04/12 06:04:27 UTC

svn commit: r1888647 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java

Author: lehmi
Date: Mon Apr 12 06:04:27 2021
New Revision: 1888647

URL: http://svn.apache.org/viewvc?rev=1888647&view=rev
Log:
PDFBOX-5162: limit usage of one byte codes to predefined encodings

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

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java?rev=1888647&r1=1888646&r2=1888647&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java Mon Apr 12 06:04:27 2021
@@ -467,15 +467,13 @@ public abstract class PDFont implements
             {
                 if (code < 256 && !(this instanceof PDType0Font))
                 {
-                    COSBase encoding = dict.getDictionaryObject(COSName.ENCODING);
-                    boolean isIdentity = encoding instanceof COSName
-                            && ((COSName) encoding).getName().startsWith("Identity");
-                    if (encoding != null && !isIdentity)
+                    COSName encoding = dict.getCOSName(COSName.ENCODING);
+                    if (encoding != null && !encoding.getName().startsWith("Identity"))
                     {
                         // due to the conversion to an int it is no longer possible to determine
                         // if the code is based on a one or two byte value. We should consider to
                         // refactor that part of the code.
-                        // However simple fonts with an encoding are using one byte codes so that
+                        // However, simple fonts with a predefined encoding are using one byte codes so that
                         // we can limit the CMap mappings to one byte codes by passing the origin length
                         return toUnicodeCMap.toUnicode(code, 1);
                     }