pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1817558 - in /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering: TTFGlyph2D.java Type1Glyph2D.java
Date Fri, 08 Dec 2017 20:10:49 GMT
Author: tilman
Date: Fri Dec  8 20:10:49 2017
New Revision: 1817558

URL: http://svn.apache.org/viewvc?rev=1817558&view=rev
Log:
PDFBOX-4001: move check for code 10 up because caching is done by gid which is always 0; improve
log msg

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/TTFGlyph2D.java
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/Type1Glyph2D.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/TTFGlyph2D.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/TTFGlyph2D.java?rev=1817558&r1=1817557&r2=1817558&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/TTFGlyph2D.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/TTFGlyph2D.java Fri
Dec  8 20:10:49 2017
@@ -116,6 +116,13 @@ final class TTFGlyph2D implements Glyph2
      */
     public GeneralPath getPathForGID(int gid, int code) throws IOException
     {
+        if (gid == 0 && !isCIDFont && code == 10 && font.isStandard14())
+        {
+            // PDFBOX-4001 return empty path for line feed on std14
+            // need to catch this early because all "bad" glyphs have gid 0
+            LOG.warn("No glyph for code " + code + " in font " + font.getName());
+            return new GeneralPath();
+        }
         GeneralPath glyphPath = glyphs.get(gid);
         if (glyphPath == null)
         {
@@ -125,19 +132,12 @@ final class TTFGlyph2D implements Glyph2
                 {
                     int cid = ((PDType0Font) font).codeToCID(code);
                     String cidHex = String.format("%04x", cid);
-                    LOG.warn("No glyph for " + code + " (CID " + cidHex + ") in font " +
+                    LOG.warn("No glyph for code " + code + " (CID " + cidHex + ") in font
" +
                             font.getName());
                 }
                 else
                 {
                     LOG.warn("No glyph for " + code + " in font " + font.getName());
-                    if (code == 10 && font.isStandard14())
-                    {
-                        // PDFBOX-4001 return empty path for line feed on std14
-                        glyphPath = new GeneralPath();
-                        glyphs.put(code, glyphPath);
-                        return glyphPath;
-                    }
                 }
             }
             

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/Type1Glyph2D.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/Type1Glyph2D.java?rev=1817558&r1=1817557&r2=1817558&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/Type1Glyph2D.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/Type1Glyph2D.java
Fri Dec  8 20:10:49 2017
@@ -57,7 +57,7 @@ final class Type1Glyph2D implements Glyp
                 String name = font.getEncoding().getName(code);
                 if (!font.hasGlyph(name))
                 {
-                    LOG.warn("No glyph for " + code + " (" + name + ") in font " + font.getName());
+                    LOG.warn("No glyph for code " + code + " (" + name + ") in font " + font.getName());
                     if (code == 10 && font.isStandard14())
                     {
                         // PDFBOX-4001 return empty path for line feed on std14



Mime
View raw message