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,
) -> ReadOnlyVar<Response<Result<FontFace, FontLoadingError>>, ArcVar<Response<Result<FontFace, FontLoadingError>>>>
pub fn register( &self, custom_font: CustomFont, ) -> ReadOnlyVar<Response<Result<FontFace, FontLoadingError>>, ArcVar<Response<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,
) -> ReadOnlyVar<Response<bool>, ArcVar<Response<bool>>>
pub fn unregister( &self, custom_family: FontName, ) -> ReadOnlyVar<Response<bool>, ArcVar<Response<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,
) -> ReadOnlyVar<Response<FontFaceList>, ArcVar<Response<FontFaceList>>>
pub fn list( &self, families: &[FontName], style: FontStyle, weight: FontWeight, stretch: FontStretch, lang: &Lang, ) -> ReadOnlyVar<Response<FontFaceList>, ArcVar<Response<FontFaceList>>>
Gets a font list that best matches the query.
sourcepub fn find(
&self,
family: &FontName,
style: FontStyle,
weight: FontWeight,
stretch: FontStretch,
lang: &Lang,
) -> ReadOnlyVar<Response<Option<FontFace>>, ArcVar<Response<Option<FontFace>>>>
pub fn find( &self, family: &FontName, style: FontStyle, weight: FontWeight, stretch: FontStretch, lang: &Lang, ) -> ReadOnlyVar<Response<Option<FontFace>>, ArcVar<Response<Option<FontFace>>>>
Find a single font face that best matches the query.
sourcepub fn normal(
&self,
family: &FontName,
lang: &Lang,
) -> ReadOnlyVar<Response<Option<FontFace>>, ArcVar<Response<Option<FontFace>>>>
pub fn normal( &self, family: &FontName, lang: &Lang, ) -> ReadOnlyVar<Response<Option<FontFace>>, ArcVar<Response<Option<FontFace>>>>
Find a single font face with all normal properties.
sourcepub fn italic(
&self,
family: &FontName,
lang: &Lang,
) -> ReadOnlyVar<Response<Option<FontFace>>, ArcVar<Response<Option<FontFace>>>>
pub fn italic( &self, family: &FontName, lang: &Lang, ) -> ReadOnlyVar<Response<Option<FontFace>>, ArcVar<Response<Option<FontFace>>>>
Find a single font face with italic style, normal weight and stretch.
sourcepub fn bold(
&self,
family: &FontName,
lang: &Lang,
) -> ReadOnlyVar<Response<Option<FontFace>>, ArcVar<Response<Option<FontFace>>>>
pub fn bold( &self, family: &FontName, lang: &Lang, ) -> ReadOnlyVar<Response<Option<FontFace>>, ArcVar<Response<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,
) -> ReadOnlyVar<Response<Vec<FontName>>, ArcVar<Response<Vec<FontName>>>>
pub fn system_fonts( &self, ) -> ReadOnlyVar<Response<Vec<FontName>>, ArcVar<Response<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> 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<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> 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 more