mirror of
https://github.com/storytold/designcraft.git
synced 2026-10-24 10:16:59 -06:00
Optical kerning was treated exactly like Metrics: the font's kern pairs and nothing else, so text set with Optical in InDesign came out wider, rewrapped and went overset in tightly fitted frames. Now the font's pairs are turned off for Optical text and each pair is spaced from its outlines (crates/compose/src/optical.rs): every glyph's ink is sampled into 28 bands across the em, the pair's mean and smallest ink gap over the bands both glyphs ink are compared with the font's stem-to-stem gap (the pair nn, or HH then oo), and the pair moves 60% of the way towards it, keeping 30% of that gap and moving at most -0.12 or +0.06 em. Latin, Greek and Cyrillic letters, digits and Western punctuation take part; spaces, marks, missing glyphs, right-to-left runs, upright and tate-chu-yoko glyphs and pairs across a fallback font keep their font spacing. Profiles and references are cached, bounded. Tests: AV, To and r. close up and nn stays; HH closes up under Optical but not Metrics (fails on main); every change on a pangram stays within the bounds and spaces keep their width; profile, gap, adjustment and character-class unit tests. Docs: typography parity Kerning row and remaining effort, gap 4, ROADMAP milestone 6 and progress log. Fixes #181.