You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2022/11/11 19:07:34 UTC

svn commit: r1905245 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java

Author: tilman
Date: Fri Nov 11 19:07:34 2022
New Revision: 1905245

URL: http://svn.apache.org/viewvc?rev=1905245&view=rev
Log:
PDFBOX-5540: if there is an encoding with differences then the workaround shouldn't be used

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

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java?rev=1905245&r1=1905244&r2=1905245&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java Fri Nov 11 19:07:34 2022
@@ -156,9 +156,13 @@ public abstract class PDFont implements
                         || COSName.IDENTITY_H.equals(encoding) //
                         || COSName.IDENTITY_V.equals(encoding))
                 {
-                    // assume that if encoding is identity, then the reverse is also true
-                    cmap = CMapManager.getPredefinedCMap(COSName.IDENTITY_H.getName());
-                    LOG.warn("Using predefined identity CMap instead");
+                    COSDictionary encodingDict = dict.getCOSDictionary(COSName.ENCODING);
+                    if (encodingDict == null || !encodingDict.containsKey(COSName.DIFFERENCES))
+                    {
+                        // assume that if encoding is identity, then the reverse is also true
+                        cmap = CMapManager.getPredefinedCMap(COSName.IDENTITY_H.getName());
+                        LOG.warn("Using predefined identity CMap instead");
+                    }
                 }
             }
         }