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
sourceimpl<'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
sourceimpl<'a> Clone for FontSelector<'a>
impl<'a> Clone for FontSelector<'a>
sourcefn clone(&self) -> FontSelector<'a>
fn clone(&self) -> FontSelector<'a>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<'a> Debug for FontSelector<'a>
impl<'a> Debug for FontSelector<'a>
sourceimpl<'a> Default for FontSelector<'a>
impl<'a> Default for FontSelector<'a>
sourcefn default() -> FontSelector<'a>
fn default() -> FontSelector<'a>
Returns the “default value” for a type. Read more
sourceimpl<'a> Hash for FontSelector<'a>
impl<'a> Hash for FontSelector<'a>
sourceimpl<'a> PartialEq<FontSelector<'a>> for FontSelector<'a>
impl<'a> PartialEq<FontSelector<'a>> for FontSelector<'a>
sourcefn eq(&self, other: &FontSelector<'a>) -> bool
fn eq(&self, other: &FontSelector<'a>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
impl<'a> Eq for FontSelector<'a>
impl<'a> StructuralEq for FontSelector<'a>
impl<'a> StructuralPartialEq for FontSelector<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for FontSelector<'a>
impl<'a> Send for FontSelector<'a>
impl<'a> Sync for FontSelector<'a>
impl<'a> Unpin for FontSelector<'a>
impl<'a> UnwindSafe for FontSelector<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<S, T> CastApprox<T> for S where
T: ConvApprox<S>,
impl<S, T> CastApprox<T> for S where
T: ConvApprox<S>,
sourcefn try_cast_approx(self) -> Result<T, Error>
fn try_cast_approx(self) -> Result<T, Error>
Try approximate conversion from Self
to T
Read more
sourcefn cast_approx(self) -> T
fn cast_approx(self) -> T
Cast approximately from Self
to T
Read more
sourceimpl<S, T> CastFloat<T> for S where
T: ConvFloat<S>,
impl<S, T> CastFloat<T> for S where
T: ConvFloat<S>,
sourcefn cast_trunc(self) -> T
fn cast_trunc(self) -> T
Cast to integer, truncating Read more
sourcefn cast_nearest(self) -> T
fn cast_nearest(self) -> T
Cast to the nearest integer Read more
sourcefn cast_floor(self) -> T
fn cast_floor(self) -> T
Cast the floor to an integer Read more
sourcefn try_cast_trunc(self) -> Result<T, Error>
fn try_cast_trunc(self) -> Result<T, Error>
Try converting to integer with truncation Read more
sourcefn try_cast_nearest(self) -> Result<T, Error>
fn try_cast_nearest(self) -> Result<T, Error>
Try converting to the nearest integer Read more
sourcefn try_cast_floor(self) -> Result<T, Error>
fn try_cast_floor(self) -> Result<T, Error>
Try converting the floor to an integer Read more
sourcefn try_cast_ceil(self) -> Result<T, Error>
fn try_cast_ceil(self) -> Result<T, Error>
Try convert the ceiling to an integer Read more