pub struct FontConfig {
pub size: f32,
pub aliases: BTreeMap<String, FontAliases>,
pub fonts: BTreeMap<TextClass, FontSelector<'static>>,
pub raster: RasterConfig,
}
Expand description
Font configuration
Note that only changes to Self::size
are currently supported at run-time.
Fields§
§size: f32
Standard font size, in units of pixels-per-Em
aliases: BTreeMap<String, FontAliases>
Font aliases, used when searching for a font family matching the key.
Example:
aliases:
sans-serif:
mode: Prepend
list:
- noto sans
Fonts are named by family. Several standard families exist, e.g. “serif”, “sans-serif”, “monospace”; these resolve to a list of aliases (e.g. “Noto Sans”, “DejaVu Sans”, “Arial”), each of which may have further aliases.
In the above example, “noto sans” is inserted at the top of the alias list for “sans-serif”.
Supported modes: Prepend
, Append
, Replace
.
fonts: BTreeMap<TextClass, FontSelector<'static>>
Standard fonts
raster: RasterConfig
Text glyph rastering settings
Implementations§
Source§impl FontConfig
Getters
impl FontConfig
Getters
Sourcepub fn size(&self) -> f32
pub fn size(&self) -> f32
Standard font size
Units: logical (unscaled) pixels per Em.
To convert to Points, multiply by three quarters.
Sourcepub fn iter_fonts(
&self,
) -> impl Iterator<Item = (&TextClass, &FontSelector<'static>)>
pub fn iter_fonts( &self, ) -> impl Iterator<Item = (&TextClass, &FontSelector<'static>)>
Get an iterator over font mappings
Source§impl FontConfig
Setters
impl FontConfig
Setters
Source§impl FontConfig
Other functions
impl FontConfig
Other functions
Sourcepub fn raster(&self) -> &RasterConfig
pub fn raster(&self) -> &RasterConfig
Get raster config
Trait Implementations§
Source§impl Clone for FontConfig
impl Clone for FontConfig
Source§fn clone(&self) -> FontConfig
fn clone(&self) -> FontConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for FontConfig
impl Debug for FontConfig
Source§impl Default for FontConfig
impl Default for FontConfig
Source§impl<'de> Deserialize<'de> for FontConfig
impl<'de> Deserialize<'de> for FontConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for FontConfig
impl PartialEq for FontConfig
Source§impl Serialize for FontConfig
impl Serialize for FontConfig
impl StructuralPartialEq for FontConfig
Auto Trait Implementations§
impl Freeze for FontConfig
impl RefUnwindSafe for FontConfig
impl Send for FontConfig
impl Sync for FontConfig
impl Unpin for FontConfig
impl UnwindSafe for FontConfig
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<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
Source§fn try_cast_approx(self) -> Result<T, Error>
fn try_cast_approx(self) -> Result<T, Error>
Source§fn cast_approx(self) -> T
fn cast_approx(self) -> T
Source§impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
Source§fn cast_trunc(self) -> T
fn cast_trunc(self) -> T
Source§fn cast_nearest(self) -> T
fn cast_nearest(self) -> T
Source§fn cast_floor(self) -> T
fn cast_floor(self) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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
.Source§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
.Source§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.Source§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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§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()
.