mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-24 09:46:59 -06:00
Cause: place_each (crates/pdf/src/import_text.rs, #3715) works out each character's tracking as the file's distance between glyph origins minus the installed font's advance. A PDF gives widths to the thousandth of an em (the standard-14 AFM metrics or /Widths), so with a font of 2048 units an em (Helvetica on macOS) every character is a hair (~0.0002 em) off. When the line isn't evenly spaced as a whole (a TJ word gap, a space read from a gap), `even` keeps every character's own value, rounding noise included, and restyled() splits the line into a run per character. text_becomes_point_type failed on macOS; Linux CI passed because Helvetica isn't installed there, its stand-in's widths differ by more than 1% and place_each falls back to the line-wide fit. Change: measure the spacing from the file's own widths: each character's pen is moved by how much wider the file says the characters before it are than the font's advances, where the file gives the character's width and the layout sets it as a glyph of its own. The tracking is then the file's (Tc, Tw, TJ), whatever font is installed; the layout check that the glyphs land within 0.02 em of the file's places is unchanged. Verification: text_becomes_point_type and all of tests_text_placement pass on macOS. New test widths_rounded_off_the_installed_fonts_advances_keep_one_tracking uses built-in Inter (non-embedded, widths rounded to thousandths), so it doesn't depend on system fonts; without the fix it fails on any platform with runs N/e/x/t/ /li/n/e/ /h/e/re. cargo xtask ci: all 10 steps passed.