Skip to content

Fix pica unit parsing in spacing width conversion - #755

Open
moritz-gross wants to merge 1 commit into
daisy:mainfrom
moritz-gross:fix/pica-width-conversion
Open

Fix pica unit parsing in spacing width conversion#755
moritz-gross wants to merge 1 commit into
daisy:mainfrom
moritz-gross:fix/pica-width-conversion

Conversation

@moritz-gross

Copy link
Copy Markdown
Collaborator

MathML space widths expressed in picas, such as 1pc, were interpreted as zero because the unit regex recognized ppc while the conversion handled pc. Correct the regex so 1pc converts to 1em under the existing 12-point font estimate, and document the return units and font assumption.

Add a regression test covering whole, fractional, and negative pica widths, plus equivalent point and em values. Existing speech and braille expectations are unchanged.

Validation: cargo test --offline --lib font_size_guess_pica_widths passed; git diff --check passed.

@moritz-gross

Copy link
Copy Markdown
Collaborator Author

@NSoiffer I've never heard of "pica" before (or the majority of these other units). This PR came to be as I just let GPT-6 run wild on the codebase to try it out for the first time.

This looks like a pretty straightforward and small fix.

Still want you to look at this before merging as this is an area of the code I've not yet worked with.

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

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant