From 3769bb59e3c8ac8bf4199001466355f0921bcc35 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Tue, 6 Oct 2026 20:35:59 +0300 Subject: [PATCH] review(#1631): drop the repeated ROMANS table; tests follow the new advances - The ROMANS advance list was pasted twice; once is enough. - The stroke-font golden checksum follows TXT's new advances (segment and vertex counts unchanged). - The tolerance compartment test checks ink against pen only for symbol cells: text fonts now advance by the reference's pen, not their ink. Co-Authored-By: Claude Opus 5.5 --- src/entities/tolerance.rs | 16 ++++++++++------ src/scene/text/lff.rs | 26 ++++++-------------------- 2 files changed, 16 insertions(+), 26 deletions(-) diff --git a/src/entities/tolerance.rs b/src/entities/tolerance.rs index a3a58e035..cd17f9603 100644 --- a/src/entities/tolerance.rs +++ b/src/entities/tolerance.rs @@ -1051,12 +1051,16 @@ mod tests { (got - (pen - spacing)).abs() < 1e-3, "{src:?}: content {got} should be pen {pen} less one {spacing} gap" ); - let expected = ink + (cell.len() as f32 - 1.0) * spacing; - assert!( - (got - expected).abs() < 1e-3, - "{src:?}: content {got} should be ink {ink} plus {} inter-run gaps", - cell.len() - 1 - ); + // Ink and pen agree only where glyphs advance by their own ink; + // the text fonts keep the advances of the fonts they stand in for. + if cell.iter().all(|run| run.font == SYMBOL_FONT) { + let expected = ink + (cell.len() as f32 - 1.0) * spacing; + assert!( + (got - expected).abs() < 1e-3, + "{src:?}: content {got} should be ink {ink} plus {} inter-run gaps", + cell.len() - 1 + ); + } } } } diff --git a/src/scene/text/lff.rs b/src/scene/text/lff.rs index 1b11ca98d..a4b422977 100644 --- a/src/scene/text/lff.rs +++ b/src/scene/text/lff.rs @@ -168,22 +168,7 @@ const SHX_ADVANCE: &[(&str, &[(u32, f32)])] = &[ (106, 4.2857), (107, 7.2857), (108, 3.4286), (109, 12.8571), (110, 8.1429), (111, 8.1429), (112, 8.1429), (113, 8.1429), (114, 5.5714), (115, 7.2857), (116, 5.1429), (117, 8.1429), (118, 6.8571), (119, 9.4286), (120, 7.2857), (121, 6.8571), (122, 7.2857), (123, 6.0000), - (124, 3.4286), (125, 6.0000), (126, 11.1429), (33, 4.2857), (34, 6.0000), (35, 9.0000), - (36, 8.5714), (38, 11.1429), (39, 4.2857), (40, 6.0000), (41, 6.0000), (42, 6.8571), - (43, 11.1429), (44, 4.2857), (45, 11.1429), (46, 4.2857), (47, 9.4286), (48, 8.5714), - (49, 8.5714), (50, 8.5714), (51, 8.5714), (52, 8.5714), (53, 8.5714), (54, 8.5714), - (55, 8.5714), (56, 8.5714), (57, 8.5714), (58, 4.2857), (59, 4.2857), (60, 10.2857), - (61, 11.1429), (62, 10.2857), (63, 7.7143), (64, 11.5714), (65, 7.7143), (66, 9.0000), - (67, 9.0000), (68, 9.0000), (69, 8.1429), (70, 7.7143), (71, 9.0000), (72, 9.4286), - (73, 3.4286), (74, 6.8571), (75, 9.0000), (76, 7.2857), (77, 10.2857), (78, 9.4286), - (79, 9.4286), (80, 9.0000), (81, 9.4286), (82, 9.0000), (83, 8.5714), (84, 6.8571), - (85, 9.4286), (86, 7.7143), (87, 10.2857), (88, 8.5714), (89, 7.7143), (90, 8.5714), - (91, 6.0000), (92, 9.4286), (93, 5.5714), (94, 9.4286), (95, 10.2857), (96, 5.1429), - (97, 8.1429), (98, 8.1429), (99, 7.7143), (100, 8.1429), (101, 7.7143), (102, 5.1429), - (103, 8.1429), (104, 8.1429), (105, 3.4286), (106, 4.2857), (107, 7.2857), (108, 3.4286), - (109, 12.8571), (110, 8.1429), (111, 8.1429), (112, 8.1429), (113, 8.1429), (114, 5.5714), - (115, 7.2857), (116, 5.1429), (117, 8.1429), (118, 6.8571), (119, 9.4286), (120, 7.2857), - (121, 6.8571), (122, 7.2857), (123, 6.0000), (124, 3.4286), (125, 6.0000), (126, 11.1429), + (124, 3.4286), (125, 6.0000), (126, 11.1429), ], ), ]; @@ -873,10 +858,11 @@ mod tests { #[test] fn lff_tessellation_golden() { let cases: &[(&str, usize, usize, f64)] = &[ - ("ABC 123", 8, 80, 2853.5141), - ("A\\LB\\lC", 6, 43, 825.5505), - ("10%%d Ö", 6, 60, 1479.1397), - ("Hello, World!", 15, 113, 5078.5248), + // "txt" keeps the advances of the font it stands in for. + ("ABC 123", 8, 80, 3189.9030), + ("A\\LB\\lC", 6, 43, 842.2172), + ("10%%d Ö", 6, 60, 1627.2223), + ("Hello, World!", 15, 113, 6029.0805), ]; for &(t, segs, verts, sum_ref) in cases { let (st, _) = tessellate_text_ex([0.0, 0.0], 10.0, 0.0, 1.0, 0.0, "txt", t);