Skip to content

Commit

Permalink
Update kas-text to 0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dhardy committed Dec 2, 2024
1 parent d90b5c3 commit 9a4ddd1
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 13 deletions.
4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion crates/kas-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions crates/kas-core/src/config/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions crates/kas-core/src/theme/simple_theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ where

fn init(&mut self, config: &RefCell<Config>) {
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
Expand Down
7 changes: 5 additions & 2 deletions crates/kas-resvg/src/svg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ enum LoadError {
fn load(data: &[u8], resources_dir: Option<&Path>) -> Result<Tree, usvg::Error> {
use once_cell::sync::Lazy;
static FONT_FAMILY: Lazy<String> = 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:
Expand Down
2 changes: 1 addition & 1 deletion crates/kas-wgpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 9a4ddd1

Please sign in to comment.