From 11b6ae8203f28162883b1171e84e4de1b788fe7e Mon Sep 17 00:00:00 2001 From: bflatastic Date: Wed, 18 Nov 2026 22:02:41 +0700 Subject: [PATCH] text: pin craft-font-catalog to craft-libs main and restore the shared outline call --- Cargo.lock | 4 +++- crates/text/Cargo.toml | 4 ++-- crates/text/src/fontdb/lookup.rs | 12 ++++-------- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3fc5fec6c9..832dec20d0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1047,12 +1047,14 @@ source = "git+https://github.com/storytold/craft-libs?rev=64b181977a0488e4d1e167 [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d0a9c79933a54883cd5bc3dfe839f1dd699f2c69#d0a9c79933a54883cd5bc3dfe839f1dd699f2c69" +source = "git+https://github.com/storytold/craft-libs?rev=23acc704933a9a5619a5cd1cddc9bb1fb5a9b2d3#23acc704933a9a5619a5cd1cddc9bb1fb5a9b2d3" dependencies = [ "harfrust 0.13.3", "kurbo 0.13.1", "skrifa 0.47.0", "thiserror 2.0.21", + "unicode-bidi", + "unicode-segmentation", "windows-registry", ] diff --git a/crates/text/Cargo.toml b/crates/text/Cargo.toml index da69b80a29..c0fc17876a 100644 --- a/crates/text/Cargo.toml +++ b/crates/text/Cargo.toml @@ -9,8 +9,8 @@ description = "VectorCraft text: font database, shaping, layout, glyph outlines" workspace = true [dependencies] -# Pending shared extraction; pin the immutable official PR head until it merges. -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "d0a9c79933a54883cd5bc3dfe839f1dd699f2c69", default-features = false } +# The shared font catalog from craft-libs main (it has the outline, bidi and caret helpers used here). +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "23acc704933a9a5619a5cd1cddc9bb1fb5a9b2d3", default-features = false } vectorcraft-geom = { workspace = true } vectorcraft-doc = { workspace = true } kurbo = { workspace = true } diff --git a/crates/text/src/fontdb/lookup.rs b/crates/text/src/fontdb/lookup.rs index d9a97128ab..8bc4634f49 100644 --- a/crates/text/src/fontdb/lookup.rs +++ b/crates/text/src/fontdb/lookup.rs @@ -10,10 +10,7 @@ use super::names::{norm, norm_chars, script_families}; #[cfg(not(target_arch = "wasm32"))] use super::scan::{enumerate_faces, font_files}; use super::traits::{Alias, FontMatch, FontTraits, regular_rank}; -use super::{ - Arc, BezPath, CANONICAL_CACHE_MAX, Color, ColourContent, FontDb, GlyphId, GlyphImage, MetadataProvider, NEXT_ID, OUTLINE_CACHE_MAX, Ordering, - Size, -}; +use super::{Arc, BezPath, CANONICAL_CACHE_MAX, Color, ColourContent, FontDb, GlyphImage, MetadataProvider, NEXT_ID, OUTLINE_CACHE_MAX, Ordering}; /// The most faces [`FontDb::postscript_faces`] gives, and the most families it loads. const MAX_POSTSCRIPT_FACES: usize = 16; @@ -655,10 +652,9 @@ impl FontDb { return p.clone(); } let mut pen = FlipPen(BezPath::new()); - if let Some(f) = face.skrifa() - && let Some(g) = f.outline_glyphs().get(GlyphId::new(gid)) - { - let _ = g.draw(DrawSettings::unhinted(Size::unscaled(), face.location()), &mut pen); + if let Ok(font) = craft_font_catalog::FontOutline::from_bytes(face.data(), face.index(), face.variations()) { + // As before, keep the prefix emitted before a malformed glyph reports an error. + let _ = font.draw_to(gid, &mut pen); } let p = Arc::new(pen.0); let mut cache = self.outlines.lock().unwrap_or_else(|e| e.into_inner());