From 173a9557c2f03bc5fda132e884c11bf8661256ff Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Sat, 5 Oct 2024 01:41:32 +0200 Subject: [PATCH] fix(app): preload embedded Fira fonts --- src/app/mod.rs | 22 ++++++++++++++++++++++ src/font.rs | 12 ++++-------- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/app/mod.rs b/src/app/mod.rs index c703b32c..21b47809 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -45,6 +45,8 @@ pub mod message { } } +use std::borrow::Cow; + pub use self::command::Command; pub use self::core::Core; pub use self::settings::Settings; @@ -72,6 +74,8 @@ pub(crate) fn iced_settings( settings: Settings, flags: App::Flags, ) -> iced::Settings<(Core, App::Flags)> { + preload_fonts(); + let mut core = Core::default(); core.debug = settings.debug; core.icon_theme_override = settings.default_icon_theme.is_some(); @@ -882,3 +886,21 @@ fn single_instance_subscription() -> Subscription Font { Font::from(crate::config::interface_font()) @@ -16,21 +12,21 @@ pub fn default() -> Font { pub fn light() -> Font { Font { - weight: iced_core::font::Weight::Light, + weight: Weight::Light, ..default() } } pub fn semibold() -> Font { Font { - weight: iced_core::font::Weight::Semibold, + weight: Weight::Semibold, ..default() } } pub fn bold() -> Font { Font { - weight: iced_core::font::Weight::Bold, + weight: Weight::Bold, ..default() } }