pub struct FONTS;
Expand description
Font loading, custom fonts and app font configuration.
Implementations§
source§impl FONTS
impl FONTS
sourcepub fn refresh(&self)
pub fn refresh(&self)
Clear cache and notify Refresh
in FONT_CHANGED_EVENT
.
See the event documentation for more information.
sourcepub fn generics(&self) -> &'static GenericFonts
pub fn generics(&self) -> &'static GenericFonts
Actual name of generic fonts.
sourcepub fn register(
&self,
custom_font: CustomFont,
) -> ResponseVar<Result<FontFace, FontLoadingError>>
pub fn register( &self, custom_font: CustomFont, ) -> ResponseVar<Result<FontFace, FontLoadingError>>
Load and register a custom font.
If the font loads correctly a FONT_CHANGED_EVENT
notification is scheduled.
Fonts sourced from a file are not monitored for changes, you can reload the font
by calling register
again with the same font name.
The returned response will update once when the font finishes loading with the new font. At minimum the new font will be available on the next update.
sourcepub fn unregister(&self, custom_family: FontName) -> ResponseVar<bool>
pub fn unregister(&self, custom_family: FontName) -> ResponseVar<bool>
Removes a custom font family. If the font faces are not in use it is also unloaded.
Returns a response var that updates once with a value that indicates if any custom font was removed.
sourcepub fn list(
&self,
families: &[FontName],
style: FontStyle,
weight: FontWeight,
stretch: FontStretch,
lang: &Lang,
) -> ResponseVar<FontFaceList>
pub fn list( &self, families: &[FontName], style: FontStyle, weight: FontWeight, stretch: FontStretch, lang: &Lang, ) -> ResponseVar<FontFaceList>
Gets a font list that best matches the query.
sourcepub fn find(
&self,
family: &FontName,
style: FontStyle,
weight: FontWeight,
stretch: FontStretch,
lang: &Lang,
) -> ResponseVar<Option<FontFace>>
pub fn find( &self, family: &FontName, style: FontStyle, weight: FontWeight, stretch: FontStretch, lang: &Lang, ) -> ResponseVar<Option<FontFace>>
Find a single font face that best matches the query.
sourcepub fn normal(
&self,
family: &FontName,
lang: &Lang,
) -> ResponseVar<Option<FontFace>>
pub fn normal( &self, family: &FontName, lang: &Lang, ) -> ResponseVar<Option<FontFace>>
Find a single font face with all normal properties.
sourcepub fn italic(
&self,
family: &FontName,
lang: &Lang,
) -> ResponseVar<Option<FontFace>>
pub fn italic( &self, family: &FontName, lang: &Lang, ) -> ResponseVar<Option<FontFace>>
Find a single font face with italic style, normal weight and stretch.
sourcepub fn bold(
&self,
family: &FontName,
lang: &Lang,
) -> ResponseVar<Option<FontFace>>
pub fn bold( &self, family: &FontName, lang: &Lang, ) -> ResponseVar<Option<FontFace>>
Find a single font face with bold weight, normal style and stretch.
sourcepub fn custom_fonts(&self) -> Vec<FontName>
pub fn custom_fonts(&self) -> Vec<FontName>
Gets all registered font families.
sourcepub fn system_fonts(&self) -> ResponseVar<Vec<FontName>>
pub fn system_fonts(&self) -> ResponseVar<Vec<FontName>>
Query all font families available in the system.
Note that the variable will only update once with the query result, this is not a live view.
sourcepub fn system_font_aa(&self) -> impl Var<FontAntiAliasing>
pub fn system_font_aa(&self) -> impl Var<FontAntiAliasing>
Gets the system font anti-aliasing config as a read-only var.
The variable updates when the system config changes.
Auto Trait Implementations§
impl Freeze for FONTS
impl RefUnwindSafe for FONTS
impl Send for FONTS
impl Sync for FONTS
impl Unpin for FONTS
impl UnwindSafe for FONTS
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<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>
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 more