You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2025/10/22 14:08:02 UTC

svn commit: r1929289 - pdfbox/branches/3.0/fontbox/src/main/java/org/apache/fontbox/ttf

Author: tilman
Date: Wed Oct 22 14:08:02 2025
New Revision: 1929289

Log:
PDFBOX-6085: add exception; revert bugfix; new bugfix that counts the initial skip

Modified:
   pdfbox/branches/3.0/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java

Modified: pdfbox/branches/3.0/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java
==============================================================================
--- pdfbox/branches/3.0/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java	Wed Oct 22 14:07:57 2025	(r1929288)
+++ pdfbox/branches/3.0/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java	Wed Oct 22 14:08:02 2025	(r1929289)
@@ -525,10 +525,6 @@ public final class TTFSubsetter
                     {
                         LOG.debug("Tried skipping " + (offset - lastOff) + " bytes but skipped only " + isResult + " bytes");
                     }
-                    if (invisibleGlyphIds.contains(gid))
-                    {
-                        continue;
-                    }
                     byte[] buf = new byte[(int) length];
                     isResult = is.read(buf);
 
@@ -634,6 +630,7 @@ public final class TTFSubsetter
                 // corresponding 'loca' table entry with length = 0
                 if (invisibleGlyphIds.contains(gid))
                 {
+                    lastOff = offset;
                     continue;
                 }
 
@@ -659,6 +656,11 @@ public final class TTFSubsetter
 
                         // glyphIndex
                         int componentGid = (buf[off] & 0xff) << 8 | buf[off + 1] & 0xff;
+                        if (!glyphIds.contains(componentGid))
+                        {
+                            // PDFBOX-6085
+                            throw new IOException("Internal error: componentGid " + componentGid + " not in glyphIds set");
+                        }
                         int newComponentGid = getNewGlyphId(componentGid);
                         buf[off]   = (byte)(newComponentGid >>> 8);
                         buf[off + 1] = (byte)newComponentGid;