pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1863703 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType2.java
Date Wed, 24 Jul 2019 16:03:44 GMT
Author: tilman
Date: Wed Jul 24 16:03:44 2019
New Revision: 1863703

URL: http://svn.apache.org/viewvc?rev=1863703&view=rev
Log:
PDFBOX-4604: display each warning only once per code

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

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType2.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType2.java?rev=1863703&r1=1863702&r2=1863703&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType2.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType2.java
Wed Jul 24 16:03:44 2019
@@ -18,6 +18,8 @@ package org.apache.pdfbox.pdmodel.font;
 
 import java.awt.geom.GeneralPath;
 import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.fontbox.cff.Type2CharString;
@@ -49,6 +51,7 @@ public class PDCIDFontType2 extends PDCI
     private final CmapLookup cmap; // may be null
     private Matrix fontMatrix;
     private BoundingBox fontBBox;
+    private final Set<Integer> noMapping = new HashSet<Integer>();
 
     /**
      * Constructor.
@@ -245,7 +248,12 @@ public class PDCIDFontType2 extends PDCI
                 String unicode = parent.toUnicode(code);
                 if (unicode == null)
                 {
-                    LOG.warn("Failed to find a character mapping for " + code + " in " +
getName());
+                    if (!noMapping.contains(code))
+                    {
+                        // we keep track of which warnings have been issued, so we don't
log multiple times
+                        noMapping.add(code);
+                        LOG.warn("Failed to find a character mapping for " + code + " in
" + getName());
+                    }
                     // Acrobat is willing to use the CID as a GID, even when the font isn't
embedded
                     // see PDFBOX-2599
                     return codeToCID(code);



Mime
View raw message