VectorCraft: An open-source, vector art tool written by scratch in pure Rust
Type: the vertical ruby test passes with craft-fonts' Shippori Mincho
dotCooCoo95f503367fe1
diff --git a/crates/text/src/tests_ruby.rs b/crates/text/src/tests_ruby.rsindex 2435fa434..fa49bf13a 100644--- a/crates/text/src/tests_ruby.rs+++ b/crates/text/src/tests_ruby.rs@@ -142,12 +142,18 @@ fn vertical_ruby_is_upright_to_the_right_of_the_column() {let ruby = ruby_ink(&lay);assert!(ruby.x0 > base.x0, "ruby right of the column: {ruby:?} vs {base:?}");assert!(ruby.x0 >= base.x1 - 1.0, "ruby outside the column: {ruby:?} vs {base:?}");- // Upright kana are taller than wide (they would be lying on their side if not).+ // Upright: each reading glyph's ink has the width and height of its outline at 10 pt (half the+ // base size); a glyph on its side has them swapped.+ let mut not_square = false;for g in &lay.ruby {- if let Some(b) = ink(g) {- assert!(b.width() <= b.height() + 1.0, "upright ruby glyph {b:?}");- }+ let Some(r) = ink(g) else { continue };+ let face = db().face_by_id(g.font_id).expect("the ruby glyph's face");+ let o = db().outline(&face, g.gid).bounding_box();+ let (w, h) = (o.width() * 10.0 / face.units_per_em(), o.height() * 10.0 / face.units_per_em());+ assert!((r.width() - w).abs() < 0.01 && (r.height() - h).abs() < 0.01, "upright ruby glyph {r:?}, its outline {w} x {h}");+ not_square |= (w - h).abs() > 0.5;}+ assert!(not_square, "one reading glyph's outline is not square");// Down the column: the reading's glyphs have distinct y positions.let ys: Vec<f64> = lay.ruby.iter().filter_map(|g| ink(g).map(|b| b.center().y)).collect();assert!(ys.windows(2).any(|w| w[0] != w[1]), "the reading runs down the column: {ys:?}");