pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r993541 - /pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/PostScriptTable.java
Date Tue, 07 Sep 2010 21:52:44 GMT
Author: jukka
Date: Tue Sep  7 21:52:44 2010
New Revision: 993541

URL: http://svn.apache.org/viewvc?rev=993541&view=rev
Log:
PDFBOX-808: PDTrueTypeFont.loadTTF() freezes

Ignore reserved glyph name indexes

Modified:
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/PostScriptTable.java

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/PostScriptTable.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/PostScriptTable.java?rev=993541&r1=993540&r2=993541&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/PostScriptTable.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/PostScriptTable.java Tue Sep
 7 21:52:44 2010
@@ -92,7 +92,11 @@ public class PostScriptTable extends TTF
             {
                 int index = data.readUnsignedShort();
                 glyphNameIndex[i] = index;
-                maxIndex = Math.max( maxIndex, index );
+                // PDFBOX-808: Index numbers between 32768 and 65535 are
+                // reserved for future use, so we should just ignore them
+                if (index <= 32767) {
+                    maxIndex = Math.max( maxIndex, index );
+                }
             }
             String[] nameArray = null;
             if( maxIndex >= 258 )
@@ -117,7 +121,9 @@ public class PostScriptTable extends TTF
                 }
                 else
                 {
-                    throw new IOException( "Unknown glyph name index:" + index );
+                    // PDFBOX-808: Index numbers between 32768 and 65535 are
+                    // reserved for future use, so we should just ignore them
+                    glyphNames[i] = ".undefined";
                 }
             }
         }



Mime
View raw message