mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-24 09:46:59 -06:00
Cause: since #3742 place_each measures a line's spacing from the file's own widths, so tracking is only the file's Tc/Tw/TJ. Where the widths are systematically off the installed font's advances (up to the 1% that still counts as the same font), those differences add up along a line and nothing made up for them. With no kerning and every tracking value 0, place_each returned the untracked layout early, without the 0.02 em placement check (CodeRabbit's review of #3742): a line of embedded Source Sans 3 with /Widths 0.8% wide opened 3.7 pt off. With the early return removed the check rejects the line and the line-wide fit takes over: one whole-thousandth tracking value with the font's kerning, 0.30 pt off (as before #3715). Before #3742 main placed it exactly but with a run per character (49 and 62 runs). Change: the early return is gone; every line goes through the check. Before it, on_course() keeps the file's spacing where the glyphs stay within 0.01 em of the file's; otherwise each stretch of the line takes one share after every character (the longest stretch one share keeps within 0.01 em), so ordinary text stays one run, and a line whose differences change course (30 m then 30 i) takes a run per stretch (2). Verification: new test a_long_line_of_widths_a_little_off_the_fonts_advances_lands_in_one_run (embedded Source Sans 3, widths x1.008 and x0.992, a kerned and an unkerned line): one run each, glyphs under 0.24 pt (0.02 em) from where the file draws them. Without on_course it fails after #3742, with and without the early return ("glyphs 0.300 pt"); before #3742 it fails on the run count. It replaces an Inter test drafted for the review: Inter isn't embedded there, so the file's outlines are the interpreter's stand-in stretched to the widths, not Inter, and the contours differ by 0.6 pt even with exact widths. tests_text_placement and text_becomes_point_type pass; cargo xtask ci: all 10 steps passed. Thanks to the CodeRabbit review on #3742 for the early-return finding.