pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jahew...@apache.org
Subject svn commit: r1760481 - in /pdfbox/trunk: fontbox/src/main/java/org/apache/fontbox/ttf/OTFParser.java fontbox/src/main/java/org/apache/fontbox/ttf/TTFParser.java pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFont.java
Date Tue, 13 Sep 2016 06:28:32 GMT
Author: jahewson
Date: Tue Sep 13 06:28:32 2016
New Revision: 1760481

URL: http://svn.apache.org/viewvc?rev=1760481&view=rev
Log:
PDFBOX-3488: Don't allow CFF fonts in TTFParser

Modified:
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/OTFParser.java
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFParser.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFont.java

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/OTFParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/OTFParser.java?rev=1760481&r1=1760480&r2=1760481&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/OTFParser.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/OTFParser.java Tue Sep 13 06:28:32
2016
@@ -104,4 +104,10 @@ public final class OTFParser extends TTF
             return super.readTable(font, tag);
         }
     }
+
+    @Override
+    protected boolean allowCFF()
+    {
+        return true;
+    }
 }

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFParser.java?rev=1760481&r1=1760480&r2=1760481&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFParser.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFParser.java Tue Sep 13 06:28:32
2016
@@ -175,7 +175,7 @@ public class TTFParser
             }
         }
 
-        boolean isPostScript = font.tables.containsKey(CFFTable.TAG);
+        boolean isPostScript = allowCFF() && font.tables.containsKey(CFFTable.TAG);
         
         HeaderTable head = font.getHeader();
         if (head == null)
@@ -232,6 +232,11 @@ public class TTFParser
         }
     }
 
+    protected boolean allowCFF()
+    {
+        return false;
+    }
+
     private TTFTable readTableDirectory(TrueTypeFont font, TTFDataStream raf) throws IOException
     {
         TTFTable table = null;

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFont.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFont.java?rev=1760481&r1=1760480&r2=1760481&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFont.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFont.java Tue
Sep 13 06:28:32 2016
@@ -443,11 +443,6 @@ public class PDTrueTypeFont extends PDSi
     @Override
     public GeneralPath getPath(int code) throws IOException
     {
-        if (ttf.getGlyph() == null)
-        {
-            throw new IOException("glyf table is missing in font " + getName());
-        }
-
         int gid = codeToGID(code);
         GlyphData glyph = ttf.getGlyph().getGlyph(gid);
         



Mime
View raw message