Struct kas_text::fonts::FontSelector
source · pub struct FontSelector<'a> { /* private fields */ }Expand description
A font face selection tool
This tool selects a font according to the given criteria from available system fonts. Selection criteria are based on CSS.
Implementations§
source§impl<'a> FontSelector<'a>
impl<'a> FontSelector<'a>
sourcepub fn new() -> Self
pub fn new() -> Self
Synonym for default
Without further parametrization, this will select a generic sans-serif font which should be suitable for most uses.
sourcepub fn assign(&mut self, rhs: &Self)
pub fn assign(&mut self, rhs: &Self)
Set self to rhs
This may save a reallocation over direct assignment.
sourcepub fn set_families(&mut self, names: Vec<Cow<'a, str>>)
pub fn set_families(&mut self, names: Vec<Cow<'a, str>>)
Set family name(s)
This supports generic names serif, sans-serif, monospace,
cursive and fantasy. It also allows specific family names, though
does not currently define compatibility aliases for these (e.g. arial
will match the Arial font if found, but should not currently be expected
to resolve other, compatible, fonts).
If multiple names are passed, the first to successfully resolve a font is used. Glyph-level fallback (missing glyph substitution) is not currently supported.
If an empty vector is passed, the default “sans-serif” font is used.
sourcepub fn set_weight(&mut self, weight: Weight)
pub fn set_weight(&mut self, weight: Weight)
Set weight
sourcepub fn set_stretch(&mut self, stretch: Stretch)
pub fn set_stretch(&mut self, stretch: Stretch)
Set stretch
Trait Implementations§
source§impl<'a> Clone for FontSelector<'a>
impl<'a> Clone for FontSelector<'a>
source§fn clone(&self) -> FontSelector<'a>
fn clone(&self) -> FontSelector<'a>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more