Struct kas::text::fonts::FontSelector [−]
pub struct FontSelector<'a> { /* fields omitted */ }
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
impl<'a> FontSelector<'a>
impl<'a> FontSelector<'a>
pub fn new() -> FontSelector<'a>
pub fn new() -> FontSelector<'a>
Synonym for default
Without further parametrisation, this will select a generic sans-serif font which should be suitable for most uses.
pub fn assign(&mut self, rhs: &FontSelector<'a>)
pub fn assign(&mut self, rhs: &FontSelector<'a>)
Set self to rhs
This may save a reallocation over direct assignment.
pub fn set_families(&mut self, names: Vec<Cow<'a, str>, Global>)
pub fn set_families(&mut self, names: Vec<Cow<'a, str>, Global>)
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 vec is passed, the default “sans-serif” font is used.
pub fn set_weight(&mut self, weight: Weight)
pub fn set_weight(&mut self, weight: Weight)
Set weight
pub fn set_stretch(&mut self, stretch: Width)
pub fn set_stretch(&mut self, stretch: Width)
Set stretch
Trait Implementations
impl<'a> Clone for FontSelector<'a>
impl<'a> Clone for FontSelector<'a>
pub fn clone(&self) -> FontSelector<'a>
pub fn clone(&self) -> FontSelector<'a>
Returns a copy of the value. Read more
Performs copy-assignment from source
. Read more
impl<'a> Debug for FontSelector<'a>
impl<'a> Debug for FontSelector<'a>
impl<'a> Default for FontSelector<'a>
impl<'a> Default for FontSelector<'a>
pub fn default() -> FontSelector<'a>
pub fn default() -> FontSelector<'a>
Returns the “default value” for a type. Read more
impl<'de, 'a> Deserialize<'de> for FontSelector<'a>
impl<'de, 'a> Deserialize<'de> for FontSelector<'a>
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<FontSelector<'a>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<FontSelector<'a>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<'a> Hash for FontSelector<'a>
impl<'a> Hash for FontSelector<'a>
impl<'a> PartialEq<FontSelector<'a>> for FontSelector<'a>
impl<'a> PartialEq<FontSelector<'a>> for FontSelector<'a>
pub fn eq(&self, other: &FontSelector<'a>) -> bool
pub fn eq(&self, other: &FontSelector<'a>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
pub fn ne(&self, other: &FontSelector<'a>) -> bool
pub fn ne(&self, other: &FontSelector<'a>) -> bool
This method tests for !=
.
impl<'a> Serialize for FontSelector<'a>
impl<'a> Serialize for FontSelector<'a>
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. 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
Mutably borrows from an owned value. Read more
impl<T> CallHasher for T where
T: Hash,
impl<T> CallHasher for T where
T: Hash,
pub fn cast_trunc(self) -> T
pub fn cast_trunc(self) -> T
Cast to integer, truncating Read more
pub fn cast_nearest(self) -> T
pub fn cast_nearest(self) -> T
Cast to the nearest integer Read more
pub fn cast_floor(self) -> T
pub fn cast_floor(self) -> T
Cast the floor to an integer Read more
pub fn try_cast_trunc(self) -> Result<T, Error>
pub fn try_cast_trunc(self) -> Result<T, Error>
Try converting to integer with truncation Read more
pub fn try_cast_nearest(self) -> Result<T, Error>
pub fn try_cast_nearest(self) -> Result<T, Error>
Try converting to the nearest integer Read more
pub fn try_cast_floor(self) -> Result<T, Error>
pub fn try_cast_floor(self) -> Result<T, Error>
Try converting the floor to an integer Read more
pub fn try_cast_ceil(self) -> Result<T, Error>
pub fn try_cast_ceil(self) -> Result<T, Error>
Try convert the ceiling to an integer Read more
Compare self to key
and return true
if they are equal.