This commit is contained in:
Ashley Wulber 2025-02-28 12:06:24 -05:00
parent 0ce914b57a
commit 76930d8624
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820
58 changed files with 173 additions and 183 deletions

View file

@ -17,7 +17,7 @@ const MONO_FAMILY_DEFAULT: &str = "Noto Sans Mono";
const SANS_FAMILY_DEFAULT: &str = "Open Sans";
/// Stores static strings of the family names for `iced::Font` compatibility.
pub static FAMILY_MAP: LazyLock<Mutex<BTreeSet<&'static str>>> = LazyLock::new(|| Mutex::default());
pub static FAMILY_MAP: LazyLock<Mutex<BTreeSet<&'static str>>> = LazyLock::new(Mutex::default);
pub static COSMIC_TK: LazyLock<RwLock<CosmicTk>> = LazyLock::new(|| {
RwLock::new(
@ -152,8 +152,7 @@ impl From<FontConfig> for iced::Font {
let mut family_map = FAMILY_MAP.lock().unwrap();
let name: &'static str = family_map
.get(font.family.as_str())
.map(|&x| x)
.get(font.family.as_str()).copied()
.unwrap_or_else(|| {
let value = font.family.clone().leak();
family_map.insert(value);