Files
Behdad EsfahbodandClaude Opus 4.8 a61e59716f [subset/cff1] Remap Encoding supplement SIDs through sidmap
cff1_subset_plan renumbers every custom SID it emits through sidmap
(charset via plan_subset_charset, Top DICT names via reassignSIDs, FD
names via sidmap[]), and the output String INDEX is serialized from
that map.  plan_subset_encoding was the one emitter that pushed the
source font's SID unchanged into subset_enc_supp_codes, so once an
earlier custom-named glyph was dropped a supplement code named the
wrong glyph, or a string past the end of the renumbered String INDEX.

Look the SID up in sidmap where the supplement entry is recorded.  The
source SID is still used for get_supplement_codes(), which searches the
source Encoding.  This is safe on every path that reaches it:
subset_encoding implies a non-CID font, so plan_subset_charset has
already added each visited glyph's name (sidmap.add is idempotent), and
when the charset is predefined and plan_subset_charset is skipped all
glyph SIDs are standard strings, which sidmap[] returns unchanged.

Adds test_subset_cff1_encoding_supplement with a generated CFF font
(custom names, format-0 Encoding with supplement 98 -> 'second') and
its expected B,C subset; the test fails before this change.

Reported by Anthropic's OSS Scanner as ordinary bug ANT-2026-JORVXUQZ.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-09 13:18:05 -06:00
..
2018-11-25 01:16:01 -05:00
2020-01-23 10:50:52 -08:00
2023-01-24 18:08:22 -07:00
2018-11-03 22:28:30 +03:30
2018-10-18 13:04:41 -07:00
2018-10-22 10:17:31 +02:00
2018-10-22 10:17:31 +02:00
2020-01-31 16:37:30 -05:00
2022-02-18 18:27:02 -06:00
2022-12-23 13:37:59 -07:00
2020-01-15 13:36:01 -08:00
2020-01-15 13:36:01 -08:00
2020-02-06 11:35:48 +03:30

cmap-format12-only files created by ttx & remove all other cmap entries

Inconsolata-Regular.abc.widerc.ttf has the hmtx width of "c" set to 600; everything else is 500. Subsetting out c should reduce numberOfHMetrics to 1.

chromacheck-* fonts are from https://github.com/RoelN/ChromaCheck/tree/master/fonts and licensed under MIT by Roel Nieskens and Google.

RanaKufi-Regular.subset.otf is from https://github.com/alif-type/rana-kufi/ but the subset is licensed for us in MIT for the project use.

glyphs.ttf is from https://github.com/RazrFalcon/ttf-parser/blob/337e7d1/tests/fonts/glyphs.ttf

Estedad-VF.ttf, licensed under OFL 1.1, is from https://github.com/aminabedi68/Estedad

graphite2-expansion.ttf is a synthetic three-glyph font generated by
../generate-graphite2-expansion-font.py. Its Graphite substitution rule expands
each "a" to 41 glyphs, for testing buffer growth failure.