Struct kas::text::fonts::FontSelector
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§
§impl<'a> FontSelector<'a>
impl<'a> FontSelector<'a>
pub fn new() -> FontSelector<'a>
pub fn new() -> FontSelector<'a>
Synonym for default
Without further parametrization, 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>>)
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.
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>
§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§impl<'a> Debug for FontSelector<'a>
impl<'a> Debug for FontSelector<'a>
§impl<'a> Default for FontSelector<'a>
impl<'a> Default for FontSelector<'a>
§fn default() -> FontSelector<'a>
fn default() -> FontSelector<'a>
§impl<'a> Hash for FontSelector<'a>
impl<'a> Hash for FontSelector<'a>
§impl<'a> PartialEq for FontSelector<'a>
impl<'a> PartialEq for FontSelector<'a>
§fn eq(&self, other: &FontSelector<'a>) -> bool
fn eq(&self, other: &FontSelector<'a>) -> bool
self
and other
values to be equal, and is used
by ==
.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§
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
§impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
§fn try_cast_approx(self) -> Result<T, Error>
fn try_cast_approx(self) -> Result<T, Error>
§fn cast_approx(self) -> T
fn cast_approx(self) -> T
§impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
§fn cast_trunc(self) -> T
fn cast_trunc(self) -> T
§fn cast_nearest(self) -> T
fn cast_nearest(self) -> T
§fn cast_floor(self) -> T
fn cast_floor(self) -> T
§fn try_cast_trunc(self) -> Result<T, Error>
fn try_cast_trunc(self) -> Result<T, Error>
§fn try_cast_nearest(self) -> Result<T, Error>
fn try_cast_nearest(self) -> Result<T, Error>
§fn try_cast_floor(self) -> Result<T, Error>
fn try_cast_floor(self) -> Result<T, Error>
§fn try_cast_ceil(self) -> Result<T, Error>
fn try_cast_ceil(self) -> Result<T, Error>
§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
§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.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.