Skip to content

pdf: endchar takes its width by operand parity like the stems and rmoveto - #1478

Merged
bflatastic merged 2 commits into
storytold:mainfrom
midasmatterhorn:fix/cff-endchar-width-polarity
Oct 16, 2026
Merged

bflatastic merged 2 commits into
storytold:mainfrom
midasmatterhorn:fix/cff-endchar-width-polarity

Conversation

@midasmatterhorn

Copy link
Copy Markdown
Contributor

A CFF glyph whose charstring is a bare four-operand endchar seac (adx ady bchar achar) imports empty: endchar called take_width(false), so it ate adx as the glyph width, left only three operands, and dropped the seac entirely; a five-operand endchar never took its leading width and silently fell back to the Private DICT default.

take_width's flag means "the no-width argument count is even" (stems and rmoveto pass true, hmoveto/vmoveto pass false), and endchar's no-width counts, 0 and 4, are both even — so it must pass true. The fix is that one-line change plus a comment; the regression test draws a base square, checks that a four-operand seac keeps its base outline, and checks that a five-operand seac reports its stated 600-unit width — both assertions fail before the fix.

Partially addresses #1446 (finding 3, endchar width polarity). Targeted tests green locally; cargo xtask ci left to the project runners.

@bflatastic
bflatastic merged commit 8f02f52 into storytold:main Oct 16, 2026
@bflatastic

Copy link
Copy Markdown
Member

Merged, thank you @midasmatterhorn! It landed on main with a batch of community PRs, after a full workspace build and test run on Windows: fmt, clippy -D warnings, about 3,500 tests, layers, assets and wasm. I merged main into the branch, keeping both your test and the seac-cycle test from #1477.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants