From 1d64e0f9ef33f8641f639d91bcd06e576fe7b52e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 15:39:28 -0800 Subject: [PATCH] Type: the harakat Tsume test also compares advances With Noto Sans Arabic the fatha's ink reaches past the first letter's left edge, so that letter's Tsume only narrows its advance and moves no glyph. The test compared glyph positions alone and found no change. It now compares each glyph's position and advance. --- crates/text/src/tests/harakat.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/text/src/tests/harakat.rs b/crates/text/src/tests/harakat.rs index 36afafdc4c..c8d93d451f 100644 --- a/crates/text/src/tests/harakat.rs +++ b/crates/text/src/tests/harakat.rs @@ -403,13 +403,15 @@ fn check_optical_tsume(db: &FontDb, family: &str) { } t }; - let xs = |t: &TextObject| layout(db, t).glyphs.iter().map(|g| g.xf.as_coeffs()[4]).collect::>(); + // Each glyph's place and advance: where a mark's ink leaves no blank space on the left, the + // Tsume of the line's first cluster only narrows its advance and moves no glyph. + let xs = |t: &TextObject| layout(db, t).glyphs.iter().flat_map(|g| [g.xf.as_coeffs()[4], g.advance]).collect::>(); assert!(xs(&set(true, None)).iter().zip(xs(&set(false, None))).any(|(a, b)| (a - b).abs() > 1e-6), "{family}: Optical moves the pair"); // Each letter in turn: the first one's cluster ends the pair, the second one's starts it. for letter in [0, 4] { let moved = |optical: bool| xs(&set(optical, Some(letter))).iter().zip(xs(&set(optical, None))).map(|(a, b)| a - b).collect::>(); let (without, with_optical) = (moved(false), moved(true)); - assert!(without.iter().any(|m| m.abs() > 1e-3), "{family} {letter}: Tsume moves the glyphs: {without:?}"); + assert!(without.iter().any(|m| m.abs() > 1e-3), "{family} {letter}: Tsume moves or narrows the glyphs: {without:?}"); assert!( without.len() == with_optical.len() && without.iter().zip(&with_optical).all(|(a, b)| (a - b).abs() < 1e-6), "{family} {letter}: {without:?} {with_optical:?}"