Skip to content

Parse padded CIDFont /W arrays without shifting glyph widths#425

Open
splitbrain wants to merge 1 commit into
PrinsFrank:mainfrom
cosmocode:fix-cidfont-padded-widths
Open

Parse padded CIDFont /W arrays without shifting glyph widths#425
splitbrain wants to merge 1 commit into
PrinsFrank:mainfrom
cosmocode:fix-cidfont-padded-widths

Conversation

@splitbrain

Copy link
Copy Markdown
Contributor

I stumbled across this issue while working on something else. This fixes a simple issue with padded /W arrays. It fixes a few obvious whitespace bugs.

A /W array whose bracketed widths are padded with spaces (e.g. "[ 722 0 333 ]")
was split with explode(' '), turning the padding into empty strings that
floatval()'d to 0. Every consecutive width then shifted one CID along, so most
glyphs resolved to width 0 -- breaking advance-width based space insertion (the
password sample read 'H ello w o r ld' instead of 'Hello world', and several
Bundestag samples gained spurious spaces around punctuation).

Split on any run of whitespace so padded and tight brackets parse identically.
@splitbrain splitbrain force-pushed the fix-cidfont-padded-widths branch from 4ee15eb to 5cd2688 Compare June 23, 2026 21:00
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.

1 participant