pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1752472 - in /pdfbox/trunk: fontbox/src/main/java/org/apache/fontbox/ttf/ pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/
Date Wed, 13 Jul 2016 17:46:56 GMT
Author: tilman
Date: Wed Jul 13 17:46:56 2016
New Revision: 1752472

URL: http://svn.apache.org/viewvc?rev=1752472&view=rev
Log:
PDFBOX-3395: revert last change and allow empty glyf table instead

Modified:
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFParser.java
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType2.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/TTFParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFParser.java?rev=1752472&r1=1752471&r2=1752472&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 Wed Jul 13 17:46:56
2016
@@ -300,8 +300,8 @@ public class TTFParser
         table.setOffset(raf.readUnsignedInt());
         table.setLength(raf.readUnsignedInt());
         
-        // skip tables with zero length
-        if (table.getLength() == 0)
+        // skip tables with zero length (except glyf)
+        if (table.getLength() == 0 && !tag.equals(GlyphTable.TAG))
         {
             return null;
         }

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java?rev=1752472&r1=1752471&r2=1752472&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java Wed Jul 13
17:46:56 2016
@@ -479,10 +479,6 @@ public final class TTFSubsetter
         do
         {
             GlyphTable g = ttf.getGlyph();
-            if (g == null)
-            {
-                throw new IOException("source font " + ttf.getName() + " must have a glyf
table");
-            }
             long[] offsets = ttf.getIndexToLocation().getOffsets();
             InputStream is = ttf.getOriginalData();
             Set<Integer> glyphIdsToAdd = null;
@@ -564,10 +560,6 @@ public final class TTFSubsetter
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
 
         GlyphTable g = ttf.getGlyph();
-        if (g == null)
-        {
-            throw new IOException("source font " + ttf.getName() + " must have a glyf table");
-        }
         long[] offsets = ttf.getIndexToLocation().getOffsets();
         InputStream is = ttf.getOriginalData();
         try

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType2.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType2.java?rev=1752472&r1=1752471&r2=1752472&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType2.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType2.java Wed
Jul 13 17:46:56 2016
@@ -27,7 +27,6 @@ import org.apache.fontbox.cff.Type2CharS
 import org.apache.fontbox.cmap.CMap;
 import org.apache.fontbox.ttf.CmapSubtable;
 import org.apache.fontbox.ttf.GlyphData;
-import org.apache.fontbox.ttf.GlyphTable;
 import org.apache.fontbox.ttf.OTFParser;
 import org.apache.fontbox.ttf.OpenTypeFont;
 import org.apache.fontbox.ttf.TrueTypeFont;
@@ -439,12 +438,7 @@ public class PDCIDFontType2 extends PDCI
         else
         {
             int gid = codeToGID(code);
-            GlyphTable glyphTable = ttf.getGlyph();
-            if (glyphTable == null)
-            {
-                return new GeneralPath();
-            }
-            GlyphData glyph = glyphTable.getGlyph(gid);
+            GlyphData glyph = ttf.getGlyph().getGlyph(gid);
             if (glyph != null)
             {
                 return glyph.getPath();

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=1752472&r1=1752471&r2=1752472&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 Wed
Jul 13 17:46:56 2016
@@ -29,7 +29,6 @@ import org.apache.fontbox.FontBoxFont;
 import org.apache.fontbox.ttf.CmapSubtable;
 import org.apache.fontbox.ttf.CmapTable;
 import org.apache.fontbox.ttf.GlyphData;
-import org.apache.fontbox.ttf.GlyphTable;
 import org.apache.fontbox.ttf.PostScriptTable;
 import org.apache.fontbox.ttf.TTFParser;
 import org.apache.fontbox.ttf.TrueTypeFont;
@@ -351,12 +350,7 @@ public class PDTrueTypeFont extends PDSi
     public float getHeight(int code) throws IOException
     {
         int gid = codeToGID(code);
-        GlyphTable glyphTable = ttf.getGlyph();
-        if (glyphTable == null)
-        {
-            return 0;
-        }
-        GlyphData glyph = glyphTable.getGlyph(gid);
+        GlyphData glyph = ttf.getGlyph().getGlyph(gid);
         if (glyph != null)
         {
             return glyph.getBoundingBox().getHeight();
@@ -448,12 +442,7 @@ public class PDTrueTypeFont extends PDSi
     public GeneralPath getPath(int code) throws IOException
     {
         int gid = codeToGID(code);
-        GlyphTable glyphTable = ttf.getGlyph();
-        if (glyphTable == null)
-        {
-            return new GeneralPath();
-        }
-        GlyphData glyph = glyphTable.getGlyph(gid);
+        GlyphData glyph = ttf.getGlyph().getGlyph(gid);
         
         // some glyphs have no outlines (e.g. space, table, newline)
         if (glyph == null)
@@ -493,12 +482,7 @@ public class PDTrueTypeFont extends PDSi
             return new GeneralPath();
         }
         
-        GlyphTable glyphTable = ttf.getGlyph();
-        if (glyphTable == null)
-        {
-            return new GeneralPath();
-        }
-        GlyphData glyph = glyphTable.getGlyph(gid);
+        GlyphData glyph = ttf.getGlyph().getGlyph(gid);
         if (glyph != null)
         {
             return glyph.getPath();



Mime
View raw message