From b2d8d3af7b3c6ee3adb68a76ffdf63da518543a3 Mon Sep 17 00:00:00 2001 From: moppeeer Date: Mon, 12 Oct 2026 00:13:57 +0200 Subject: [PATCH] fix(ui): The font menu's filters don't keep every font loaded The class, Recently Added and Show Similar Fonts filters read every family's kind through face(), which loads the family and keeps its bytes for the session (with no size cap). They use family_kind now, which reads each file and lets it go. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/panels/font_menu.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/panels/font_menu.rs b/crates/ui-egui/src/panels/font_menu.rs index aa28f0318..7a50791c9 100644 --- a/crates/ui-egui/src/panels/font_menu.rs +++ b/crates/ui-egui/src/panels/font_menu.rs @@ -91,10 +91,12 @@ fn lock(kinds: &SharedKinds) -> std::sync::MutexGuard<'_, Kinds> { kinds.lock().unwrap_or_else(std::sync::PoisonError::into_inner) } -/// A family's kind, and whether its file was added within [`ADDED_WITHIN`]. +/// A family's kind, and whether its file was added within [`ADDED_WITHIN`]. Read without keeping +/// the family loaded: the filters look at every installed family. fn family_kind(fonts: &designcraft_fonts::ScopedFonts<'static>, family: &str) -> (FaceKind, bool) { - let face = fonts.face(family, ®ular(&fonts.styles(family))); - (face.kind(), face.added().and_then(|t| t.elapsed().ok()).is_some_and(|age| age < ADDED_WITHIN)) + fonts + .family_kind(family) + .map_or((FaceKind::default(), false), |(kind, added)| (kind, added.and_then(|t| t.elapsed().ok()).is_some_and(|age| age < ADDED_WITHIN))) } /// The families' kinds, starting to read them the first time they're needed for `scope`.