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