GenericFonts

Struct GenericFonts 

Source
#[non_exhaustive]
pub struct GenericFonts {}
Expand description

Generic fonts configuration for the app.

This type can be accessed from the FONTS service.

§Defaults

By default the serif, sans_serif, monospace, cursive and fantasy are set to their own generic name, this delegates the resolution to the operating system. The set_* methods can be used to override the default.

The default fallback font is “Segoe UI Symbol” for Windows, “Standard Symbols PS” for Linux and “sans-serif” for others.

See also FontNames::system_ui for the default font selection for system-ui.

Implementations§

Source§

impl GenericFonts

Source

pub fn serif(&self, lang: &Lang) -> FontName

Gets the serif font for the given language.

Returns a font name for the best lang match.

Note that the returned name can still be the generic "serif", this delegates the resolution to the operating system.

Source

pub fn set_serif<F: Into<FontName>>(&self, lang: Lang, font_name: F)

Sets the serif font for the given language.

The change is applied for the next update.

Use lang!(und) to set name used when no language matches.

Source

pub fn sans_serif(&self, lang: &Lang) -> FontName

Gets the sans-serif font for the given language.

Returns a font name for the best lang match.

Note that the returned name can still be the generic "sans-serif", this delegates the resolution to the operating system.

Source

pub fn set_sans_serif<F: Into<FontName>>(&self, lang: Lang, font_name: F)

Sets the sans-serif font for the given language.

The change is applied for the next update.

Use lang!(und) to set name used when no language matches.

Source

pub fn monospace(&self, lang: &Lang) -> FontName

Gets the monospace font for the given language.

Returns a font name for the best lang match.

Note that the returned name can still be the generic "monospace", this delegates the resolution to the operating system.

Source

pub fn set_monospace<F: Into<FontName>>(&self, lang: Lang, font_name: F)

Sets the monospace font for the given language.

The change is applied for the next update.

Use lang!(und) to set name used when no language matches.

Source

pub fn cursive(&self, lang: &Lang) -> FontName

Gets the cursive font for the given language.

Returns a font name for the best lang match.

Note that the returned name can still be the generic "cursive", this delegates the resolution to the operating system.

Source

pub fn set_cursive<F: Into<FontName>>(&self, lang: Lang, font_name: F)

Sets the cursive font for the given language.

The change is applied for the next update.

Use lang!(und) to set name used when no language matches.

Source

pub fn fantasy(&self, lang: &Lang) -> FontName

Gets the fantasy font for the given language.

Returns a font name for the best lang match.

Note that the returned name can still be the generic "fantasy", this delegates the resolution to the operating system.

Source

pub fn set_fantasy<F: Into<FontName>>(&self, lang: Lang, font_name: F)

Sets the fantasy font for the given language.

The change is applied for the next update.

Use lang!(und) to set name used when no language matches.

Source

pub fn system_ui(&self, lang: &Lang) -> FontNames

Gets the “system-ui” font for the given language.

Returns a font name list for the best lang match.

Note that the returned names can still contain the generic "system-ui", this delegates the resolution to the operating system.

Source

pub fn set_system_ui(&self, lang: Lang, font_names: impl Into<FontNames>)

Sets the “system-ui” fonts for a the given language.

The change is applied for the next update.

Use lang!(und) to set fonts used when no language matches.

Source

pub fn fallback(&self, lang: &Lang) -> FontName

Gets the ultimate fallback font used when none of the other fonts support a glyph.

Returns a font name.

Source

pub fn set_fallback<F: Into<FontName>>(&self, lang: Lang, font_name: F)

Sets the ultimate fallback font used when none of other fonts support a glyph.

The change applies for the next update.

Use lang!(und) to set name used when no language matches.

Source

pub fn resolve(&self, name: &FontName, lang: &Lang) -> Option<FontName>

Returns the font name registered for the generic name and lang.

Returns None if name if not one of the generic font names.

Note that this does not resolve "system-ui", use resolve_list for that.

Source

pub fn resolve_list(&self, names: &[FontName], lang: &Lang) -> Option<FontNames>

Returns a new list if any name in names can resolve.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> StateValue for T
where T: Any + Send + Sync,