From 017c846889c274814e52ff1001d222eb93448a14 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Fri, 9 Oct 2026 04:39:56 +0700 Subject: [PATCH] Tests: the top-to-top em box check needs the craft-fonts CJK faces Without craft-fonts the CJK text falls back to a system font with its own em box (Windows: 34.0 instead of 35.2 at 40 pt); the relative alignment checks hold either way. Co-Authored-By: Claude Opus 5.5 --- crates/text/src/tests_typo.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/text/src/tests_typo.rs b/crates/text/src/tests_typo.rs index 9fe691a8c..70fce4fe5 100644 --- a/crates/text/src/tests_typo.rs +++ b/crates/text/src/tests_typo.rs @@ -617,7 +617,11 @@ fn vertical_align_with_top_to_top_leading() { t.para.leading_model = LeadingModel::EmBoxTop; let top = layout(db(), &t); assert_eq!(top.lines.len(), 3); - assert!((top.lines[0].baseline - 0.88 * 40.0).abs() < 0.01, "first em box at the top: {}", top.lines[0].baseline); + // The em box top sits 0.88 em above the baseline in the craft-fonts CJK faces; a system + // fallback (no craft-fonts) has its own metrics, which the relative checks below don't need. + if !crate::CRAFT_FONTS.is_empty() { + assert!((top.lines[0].baseline - 0.88 * 40.0).abs() < 0.01, "first em box at the top: {}", top.lines[0].baseline); + } let gaps = |l: &TextLayout| l.lines.windows(2).map(|w| w[1].baseline - w[0].baseline).collect::>(); let bottom = layout_with(db(), &t, &valign(VerticalAlign::Bottom)); assert!(block_space(&bottom, 300.0).1.abs() < 1e-6, "{:?}", block_space(&bottom, 300.0));