From de5ba60bc47fdce0149a24e6ddfb60c33ebd33b1 Mon Sep 17 00:00:00 2001 From: fede9234 Date: Wed, 14 Oct 2026 16:44:20 +0200 Subject: [PATCH] Text: colour-glyph comments cite the right source and size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The placement formula is Skia's own fontations port (src/ports/fontations/src/bitmap.rs) reading the sbix spec's lower-left-corner rule; the earlier comment named CoreText, which that source does not mention. Apple Color Emoji measures ~180 MB on current macOS (the 190 MB figure is a hosted copy of the file), so the comments say ~180 MB. No behaviour change: comments only. 🤖 Generated with Codebuff Co-Authored-By: Codebuff --- crates/text/src/color.rs | 7 ++++--- crates/text/src/fontdb.rs | 4 ++-- crates/text/src/layout.rs | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/crates/text/src/color.rs b/crates/text/src/color.rs index 101dabc9..85509214 100644 --- a/crates/text/src/color.rs +++ b/crates/text/src/color.rs @@ -136,9 +136,10 @@ impl Face { made } - /// Read a strike bitmap and place it. The formula is the one Skia (and CoreText behind it) - /// uses: bearings are in font units and scale with the em, the origin offsets and the image - /// with the strike's ppem, and an sbix image is measured from its lower-left corner. + /// Read a strike bitmap and place it the way Skia's fontations port does + /// (`src/ports/fontations/src/bitmap.rs`): the outer bearings are in font units and scale with + /// the em, the inner ones are pixels at the strike's ppem, and an sbix image is measured from + /// its lower-left corner (the spec places the graphic's origin at the glyph box's xMin, yMin). fn read_bitmap(&self, gid: u32, size: f64) -> Option { let gid = GlyphId::new(gid); let font = FontRef::from_index(self.bytes.data(), self.index).ok()?; diff --git a/crates/text/src/fontdb.rs b/crates/text/src/fontdb.rs index a83fa0fe..24e6495b 100644 --- a/crates/text/src/fontdb.rs +++ b/crates/text/src/fontdb.rs @@ -639,7 +639,7 @@ impl FontDb { } /// Colour emoji faces, for characters no other fallback covers. Kept out of - /// [`fallbacks`](Self::fallbacks) because the files are large (Apple Color Emoji is ~190 MB) + /// [`fallbacks`](Self::fallbacks) because the files are large (Apple Color Emoji is ~180 MB) /// and only texts that actually show emoji need them; each family reads one face. pub fn emoji_fallbacks(&mut self) -> Vec> { let mut out = Vec::new(); @@ -725,7 +725,7 @@ fn scan_dir(dir: &std::path::Path, depth: usize, out: &mut BTreeMap, box_height: Option) for s in &styles { faces.push(dbw.find(&s.font_family, &s.font_style).or_else(|| dbw.default_face())); } - // Colour emoji are their own, large faces (Apple Color Emoji is ~190 MB): they are read only + // Colour emoji are their own, large faces (Apple Color Emoji is ~180 MB): they are read only // for a text whose characters nothing above covers. let covered = |c: char| c == '\n' || faces.iter().flatten().any(|f| f.has_char(c)) || fallbacks.iter().any(|f| f.has_char(c)); if chars.iter().any(|c| !covered(*c)) {