i18n: the baseline test reads the sign, not a fixed 1.5 pt

Measured on a second machine (Noto Sans CJK JP), the ink-bottom gap after the
correction is 1.125 / 1.9375 / 1.71875 pt at 12 / 15 / 18 pt, so the old bound
failed at 15 and 18 where the interface is right. Without the correction the kana
sits 3-5 pt above the Latin ink, so the sign separates the two and the magnitude
only has to allow the face's own kana overshoot.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@deepseek.com>
This commit is contained in:
zitann2020
2026-10-26 02:39:01 +09:00
co-authored by DeepSeek V4.1 Flash
parent 153fca19bc
commit a50a182a5f
+12 -3
View File
@@ -811,10 +811,19 @@ mod script_font_tests {
let row = &galley.rows[0].glyphs;
assert_eq!(row.len(), 2, "A\u{3042} should shape to two glyphs");
let (latin, kana) = (bottom(&row[0]), bottom(&row[1]));
let drift = (kana - latin).abs();
let drift = kana - latin;
// Without the correction the kana sits 3-5 pt *above* the Latin ink, so the sign is
// what tells the two apart. With it, the kana reaches a little *below* the Latin
// one, by however far the face's kana overshoot past the baseline - measured at
// 1.94 pt for Noto Sans CJK JP against Yu Gothic's 0.4 - plus up to half a point of
// whole-point rounding in `pos.y` for each glyph.
assert!(
drift < 1.5,
"the kana sits {drift:.2} pt off the Latin baseline at {size} pt in {family:?} (latin {latin}, kana {kana}); the fallback tweak is missing or wrong"
drift > -0.5,
"the kana sits {drift:.2} pt above the Latin baseline at {size} pt in {family:?} (latin {latin}, kana {kana}); the fallback tweak is missing or wrong"
);
assert!(
drift < 2.5,
"the kana sits {drift:.2} pt below the Latin baseline at {size} pt in {family:?} (latin {latin}, kana {kana}); the fallback tweak is too large"
);
}
}