pub enum FamilyOwned {
Name(String),
Serif,
SansSerif,
Cursive,
Fantasy,
Monospace,
}Expand description
An owned font family identifier.
This is an owned equivalent of Parley’s FontFamily that can be stored
and cloned independently of any layout context. It supports both named fonts
and the standard CSS generic families.
§Example
use floem_renderer::text::FamilyOwned;
let families: Vec<FamilyOwned> = FamilyOwned::parse_list("'Fira Code', monospace").collect();
assert_eq!(families, vec![
FamilyOwned::Name("Fira Code".to_string()),
FamilyOwned::Monospace,
]);Variants§
Name(String)
A named font family (e.g. "Helvetica", "Fira Code").
Serif
The generic serif family.
SansSerif
The generic sans-serif family.
Cursive
The generic cursive family.
Fantasy
The generic fantasy family.
Monospace
The generic monospace family.
Implementations§
Source§impl FamilyOwned
impl FamilyOwned
Sourcepub fn parse_list(s: &str) -> impl Iterator<Item = FamilyOwned> + '_ + Clone
pub fn parse_list(s: &str) -> impl Iterator<Item = FamilyOwned> + '_ + Clone
Parses a CSS-style comma-separated font family list into an iterator of FamilyOwned values.
Quoted names (single or double quotes) are treated as named families.
Unquoted generic keywords (serif, sans-serif, monospace, cursive, fantasy)
are mapped to their corresponding variants. All other unquoted names become
FamilyOwned::Name.
§Example
use floem_renderer::text::FamilyOwned;
let families: Vec<_> = FamilyOwned::parse_list("Arial, sans-serif").collect();
assert_eq!(families, vec![
FamilyOwned::Name("Arial".to_string()),
FamilyOwned::SansSerif,
]);Sourcepub fn to_font_stack(families: &[FamilyOwned]) -> FontStack<'_>
pub fn to_font_stack(families: &[FamilyOwned]) -> FontStack<'_>
Converts a slice of owned families into a Parley [FontStack].
For a single named family, this produces a [FontStack::Source] so that
Parley can parse comma-separated fallbacks within the name string.
For a single generic family, it produces [FontStack::Single].
For multiple families, it produces [FontStack::List] preserving the
full fallback chain.
An empty slice defaults to sans-serif.
Trait Implementations§
Source§impl Clone for FamilyOwned
impl Clone for FamilyOwned
Source§fn clone(&self) -> FamilyOwned
fn clone(&self) -> FamilyOwned
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FamilyOwned
impl Debug for FamilyOwned
Source§impl Hash for FamilyOwned
impl Hash for FamilyOwned
Source§impl PartialEq for FamilyOwned
impl PartialEq for FamilyOwned
impl Eq for FamilyOwned
impl StructuralPartialEq for FamilyOwned
Auto Trait Implementations§
impl Freeze for FamilyOwned
impl RefUnwindSafe for FamilyOwned
impl Send for FamilyOwned
impl Sync for FamilyOwned
impl Unpin for FamilyOwned
impl UnsafeUnpin for FamilyOwned
impl UnwindSafe for FamilyOwned
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.