pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1859686 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java
Date Wed, 22 May 2019 05:53:55 GMT
Author: lehmi
Date: Wed May 22 05:53:54 2019
New Revision: 1859686

URL: http://svn.apache.org/viewvc?rev=1859686&view=rev
Log:
PDFBOX-4550: improve the replacement of a buggy identity cmap

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=1859686&r1=1859685&r2=1859686&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 Wed May 22
05:53:54 2019
@@ -148,10 +148,11 @@ public abstract class PDFont implements
             if (cmap != null && !cmap.hasUnicodeMappings())
             {
                 LOG.warn("Invalid ToUnicode CMap in font " + getName());
-                String cmapName = cmap.getName() != null ? cmap.getName() : cmap.getOrdering();
+                String cmapName = cmap.getName() != null ? cmap.getName() : "";
+                String ordering = cmap.getOrdering() != null ? cmap.getOrdering() : "";
                 COSBase encoding = dict.getDictionaryObject(COSName.ENCODING);
-                if ( cmapName != null && cmapName.contains("Identity") //
-                        && (COSName.IDENTITY_H.equals(encoding) //
+                if ((cmapName.contains("Identity") || (ordering.contains("Identity")))//
+                        && (COSName.IDENTITY_H.equals(encoding)
                                 || COSName.IDENTITY_V.equals(encoding)))
                 {
                     // assume that if encoding is identity, then the reverse is also true



Mime
View raw message