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:07:58 UTC
svn commit: r1929288 - pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf
Author: tilman
Date: Wed Oct 22 14:07:57 2025
New Revision: 1929288
Log:
PDFBOX-6085: add exception; revert bugfix; new bugfix that counts the initial skip
Modified:
pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java
Modified: pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java
==============================================================================
--- pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java Wed Oct 22 14:07:53 2025 (r1929287)
+++ pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java Wed Oct 22 14:07:57 2025 (r1929288)
@@ -517,10 +517,6 @@ public final class TTFSubsetter
long offset = offsets[gid];
long length = offsets[gid + 1] - offset;
is.skip(offset - lastOff);
- if (invisibleGlyphIds.contains(gid))
- {
- continue;
- }
byte[] buf = new byte[(int) length];
is.read(buf);
// rewrite glyphIds for compound glyphs
@@ -615,6 +611,7 @@ public final class TTFSubsetter
// corresponding 'loca' table entry with length = 0
if (invisibleGlyphIds.contains(gid))
{
+ lastOff = offset;
continue;
}
@@ -635,6 +632,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;