From 9a4ddd1eacafd7efd53a533a56f6e88088ee5372 Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Mon, 2 Dec 2024 13:56:43 +0000 Subject: [PATCH] Update kas-text to 0.7.0 --- Cargo.toml | 4 ---- crates/kas-core/Cargo.toml | 2 +- crates/kas-core/src/config/font.rs | 6 +++--- crates/kas-core/src/theme/simple_theme.rs | 4 ++-- crates/kas-resvg/src/svg.rs | 7 +++++-- crates/kas-wgpu/Cargo.toml | 2 +- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8ee8eef3b..434429fff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -161,7 +161,3 @@ members = [ "crates/kas-view", "examples/mandlebrot", ] - -[patch.crates-io.kas-text] -git = "https://github.com/kas-gui/kas-text.git" -rev = "8828bb3df7c34559e18429a18a38974ddc3e905f" diff --git a/crates/kas-core/Cargo.toml b/crates/kas-core/Cargo.toml index 87337304e..4e710597d 100644 --- a/crates/kas-core/Cargo.toml +++ b/crates/kas-core/Cargo.toml @@ -123,7 +123,7 @@ version = "0.14.1" path = "../kas-macros" [dependencies.kas-text] -version = "0.6.0" +version = "0.7.0" [dependencies.easy-cast] version = "0.5.0" # used in doc links diff --git a/crates/kas-core/src/config/font.rs b/crates/kas-core/src/config/font.rs index 34f8faf7d..a28bce6bd 100644 --- a/crates/kas-core/src/config/font.rs +++ b/crates/kas-core/src/config/font.rs @@ -5,7 +5,7 @@ //! Font configuration -use crate::text::fonts::{self, AddMode, FontSelector}; +use crate::text::fonts::{library, AddMode, FontSelector}; use crate::theme::TextClass; use crate::Action; use std::collections::BTreeMap; @@ -166,9 +166,9 @@ impl FontConfig { /// Apply config effects which only happen on startup pub(super) fn init(&self) { if !self.aliases.is_empty() { - fonts::library().update_db(|db| { + library().adjust_resolver(|resolver| { for (family, aliases) in self.aliases.iter() { - db.add_aliases( + resolver.add_aliases( family.to_string().into(), aliases.list.iter().map(|s| s.to_string().into()), aliases.mode, diff --git a/crates/kas-core/src/theme/simple_theme.rs b/crates/kas-core/src/theme/simple_theme.rs index 94fb4edf6..435559762 100644 --- a/crates/kas-core/src/theme/simple_theme.rs +++ b/crates/kas-core/src/theme/simple_theme.rs @@ -72,8 +72,8 @@ where fn init(&mut self, config: &RefCell) { let fonts = fonts::library(); - if let Err(e) = fonts.select_default() { - panic!("Error loading font: {e}"); + if let Err(e) = fonts.init() { + panic!("Error initializing fonts: {e}"); } self.fonts = Some(Rc::new( config diff --git a/crates/kas-resvg/src/svg.rs b/crates/kas-resvg/src/svg.rs index c65f89b5e..6acdfe135 100644 --- a/crates/kas-resvg/src/svg.rs +++ b/crates/kas-resvg/src/svg.rs @@ -26,8 +26,11 @@ enum LoadError { fn load(data: &[u8], resources_dir: Option<&Path>) -> Result { use once_cell::sync::Lazy; static FONT_FAMILY: Lazy = Lazy::new(|| { - let fonts_db = kas::text::fonts::library().read_db(); - fonts_db.font_family_from_alias("SERIF").unwrap_or_default() + let resolver = kas::text::fonts::library().resolver(); + let db = kas::text::fonts::db().unwrap(); + resolver + .font_family_from_alias(db, "SERIF") + .unwrap_or_default() }); // Defaults are taken from usvg::Options::default(). Notes: diff --git a/crates/kas-wgpu/Cargo.toml b/crates/kas-wgpu/Cargo.toml index b61084a4d..99e191910 100644 --- a/crates/kas-wgpu/Cargo.toml +++ b/crates/kas-wgpu/Cargo.toml @@ -44,7 +44,7 @@ package = "kas-core" path = "../kas-core" [dependencies.kas-text] -version = "0.6.0" +version = "0.7.0" [dependencies.wgpu] version = "23.0.1"