From 2450df67359435ba45d8b3032b7e49d6e5829ea6 Mon Sep 17 00:00:00 2001 From: aiongg Date: Sun, 22 Nov 2026 06:07:57 +0000 Subject: [PATCH] FontPicker: production's row (star column, aligned names, unframed sample column, format badge), preview banner on a well, class column as options, ghost Clear All, rule after recents, private families hidden, samples need outlines, loading state --- crates/font-manager/src/panel/specimen.rs | 16 +- crates/font-manager/src/picker.rs | 96 ++++++++-- crates/font-manager/src/picker/banner.rs | 114 +++++++++++ crates/font-manager/src/picker/rank.rs | 26 ++- crates/font-manager/src/picker/rows.rs | 218 +++++++++++++--------- crates/font-manager/tests/it/picker.rs | 68 +++++++ 6 files changed, 415 insertions(+), 123 deletions(-) create mode 100644 crates/font-manager/src/picker/banner.rs diff --git a/crates/font-manager/src/panel/specimen.rs b/crates/font-manager/src/panel/specimen.rs index fad35bc7d..a5ede8efe 100644 --- a/crates/font-manager/src/panel/specimen.rs +++ b/crates/font-manager/src/panel/specimen.rs @@ -1,5 +1,7 @@ //! `FontSample`: text in a font face at the user's sample size, on one line at the reading start of its rect. +use std::borrow::Cow; + use craft_behavior::Sense; use craft_ui::contract::{Common, Component, Cx, DisabledLook, MeasureCx, PaintUi, Props as _, Role}; use craft_ui::fonts::FontRef; @@ -37,7 +39,7 @@ pub(crate) enum SampleFace<'a> { } impl SampleFace<'_> { - fn shown(&self, at: &impl craft_ui::primitives::FacesCx) -> Shown { + pub(crate) fn shown(&self, at: &impl craft_ui::primitives::FacesCx) -> Shown { match self { SampleFace::Face { catalog, owner, face } => faces::shown(at, catalog, *owner, face), SampleFace::Interface => Shown::Unavailable, @@ -57,15 +59,15 @@ impl SampleFace<'_> { pub(crate) struct FontSample<'a> { #[common] common: Common, - text: &'a str, + text: Cow<'a, str>, face: SampleFace<'a>, points: f32, } impl<'a> FontSample<'a> { /// A sample of `text` in `face` at `points`, named `label`. - pub(crate) fn new(label: impl Into