Struct zng_ext_font::GenericFonts

source ·
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 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 UIs.

Implementations§

source§

impl GenericFonts

source

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

Gets the fallback 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 fallback serif font for the given language.

The change 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 fallback 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 fallback sans-serif font for the given language.

The change 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 fallback 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 fallback monospace font for the given language.

The change 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 fallback 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 fallback cursive font for the given language.

The change 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 fallback 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 fallback fantasy font for the given language.

The change applied for the next update.

Use lang!(und) to set name 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.

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
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T

source§

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