From fb727aa1b9ab14597683537bcb6ebf2abdaa4bd1 Mon Sep 17 00:00:00 2001 From: aiongg Date: Sat, 10 Oct 2026 16:45:36 +0000 Subject: [PATCH] Integration: #330's Aki Below test measures the em box tops #330 wrote cjk_aki_below_sets_the_upper_lines_leading_below_it on a base where Aki Below measured from the em box bottom. feat/cjk-typography measures it from the em box top (as the corpus shows), so the test asserts that the lower line's em box top sits the upper line's leading below the upper line's. --- crates/compose/src/tests.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/compose/src/tests.rs b/crates/compose/src/tests.rs index 4a6144d9b..a10a7d9db 100644 --- a/crates/compose/src/tests.rs +++ b/crates/compose/src/tests.rs @@ -3061,12 +3061,14 @@ fn cjk_aki_below_sets_the_upper_lines_leading_below_it() { }; let lines = lines_with(japanese()); assert_eq!(lines.len(), 2); - let em_bottom = |l: &Line| { + // Aki Below measures from the em box tops: the lower line's sits the upper line's leading + // below the upper line's. + let em_top = |l: &Line| { let g = &l.glyphs[0]; let (a, b) = g.face.vertical_metrics(); - l.baseline + b / (a + b) * g.face.units_per_em() * g.sy + l.baseline - a / (a + b) * g.face.units_per_em() * g.sy }; - let gap = em_bottom(&lines[1]) - em_bottom(&lines[0]); + let gap = em_top(&lines[1]) - em_top(&lines[0]); assert!((gap - 40.0).abs() < 1e-6, "{gap}"); // The other composers advance by the lower line's leading, baseline to baseline. let lines = lines_with(ParaAttrs::default());