File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
fontbox/src/main/java/org/apache/fontbox/ttf Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -527,10 +527,6 @@ private void addCompoundReferences() throws IOException
527527 LOG .debug ("Tried skipping {} bytes but skipped only {} bytes" ,
528528 offset - lastOff , isResult );
529529 }
530- if (invisibleGlyphIds .contains (gid ))
531- {
532- continue ;
533- }
534530 byte [] buf = new byte [(int ) length ];
535531 isResult = is .read (buf );
536532
@@ -638,6 +634,7 @@ private byte[] buildGlyfTable(long[] newOffsets) throws IOException
638634 // corresponding 'loca' table entry with length = 0
639635 if (invisibleGlyphIds .contains (gid ))
640636 {
637+ lastOff = offset ;
641638 continue ;
642639 }
643640
@@ -663,6 +660,11 @@ private byte[] buildGlyfTable(long[] newOffsets) throws IOException
663660
664661 // glyphIndex
665662 int componentGid = (buf [off ] & 0xff ) << 8 | buf [off + 1 ] & 0xff ;
663+ if (!glyphIds .contains (componentGid ))
664+ {
665+ // PDFBOX-6085
666+ throw new IOException ("Internal error: componentGid " + componentGid + " not in glyphIds set" );
667+ }
666668 int newComponentGid = getNewGlyphId (componentGid );
667669 buf [off ] = (byte )(newComponentGid >>> 8 );
668670 buf [off + 1 ] = (byte )newComponentGid ;
You can’t perform that action at this time.
0 commit comments