Repository navigation
fix(font): validate CFF output and preserve fractional widths - #1061
Merged
Merged
Conversation
andiwand
force-pushed
the
review/42-type1-charstrings
branch
from
October 5, 2026 12:48
8db1ac8 to
87186bf
Compare
build_cff now refuses duplicate glyph names, and Type1Font keeps every CharStrings entry, so a font that repeats a name lost all its glyphs. to_cff now keeps the first charstring of a repeated name. dict_number uses util::number::to_integer. The too-many-glyphs test now starts with .notdef, so it fails on the count and not on the missing .notdef. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gb1fLafqqzehpqPuU6uBfn
andiwand
force-pushed
the
review/43-cff-builder
branch
from
October 5, 2026 13:05
772a392 to
2db849a
Compare
andiwand
added a commit
that referenced
this pull request
Oct 5, 2026
The PDF outputs changed with #1060, #1061 and #1068: Type1 and CFF font data, and embedded PNGs split into 64 KiB IDAT chunks. Only data URIs differ. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gb1fLafqqzehpqPuU6uBfn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Generated with Claude Code
The CFF builder narrowed counts, SIDs and offsets without checking and cast width operands directly to integers. Validate glyph sets and representable output sizes, encode finite real DICT operands, and preserve fractional charstring widths until the final advance is computed.
Reuse the CFF standard glyph-name IDs instead of writing those names into every font's String INDEX. This reduces generated font data while leaving glyph order unchanged. The Type1 conversion keeps the first charstring of a repeated glyph name, because the builder now refuses duplicate names.
Validation: 50 targeted CFF, Type1, font-file and PDF-font tests pass. Two focused regressions cover fractional arithmetic, standard-name reuse, non-finite values and invalid glyph sets. The committed standard-string tables match their generator and contain 391 unique names.