Skip to main content

FontManager

Struct FontManager 

Source
pub struct FontManager { /* private fields */ }
Expand description

The font manager is used to query the system’s installed fonts and is responsible for caching loaded fonts. It is also responsible for the font fallback.

Implementations§

Source§

impl FontManager

Source

pub const FONT_COLLECTION_SCHEME: &'static str = "fonts"

Source

pub const SYSTEM_FONT_SCHEME: &'static str = "systemfont"

Source

pub const COMPOSITE_FONT_SCHEME: &'static str = "compositefont"

Source

pub fn system_fonts_key() -> Uri

The key of the system font collection (fonts:SystemFonts).

Internal upstream, where the Skia unit tests see it; public here so that the tests of the Skia crate reach it.

Source

pub fn new(platform_impl: Rc<dyn IFontManagerImpl>) -> Rc<FontManager>

Creates a font manager on top of a font backend. The FontManagerOptions registered with the locator, if any, are applied.

Panics when neither the options nor the backend nor the installed fonts give a default font family name.

Source

pub fn current() -> Rc<FontManager>

Get the current font manager instance.

The font manager registered with the locator, or a new one created on top of the registered font backend (and then registered).

Panics when no font backend (IFontManagerImpl) is registered.

Source

pub fn default_font_family(&self) -> &FontFamily

Gets the system’s default font family.

Source

pub fn system_fonts(&self) -> Rc<dyn IFontCollection>

Get all system fonts.

Source

pub fn platform_impl(&self) -> &Rc<dyn IFontManagerImpl>

The font backend.

Internal upstream, where the Skia unit tests see it; public here so that the tests of the Skia crate reach it.

Source

pub fn try_get_glyph_typeface( &self, typeface: &Typeface, ) -> Option<Rc<GlyphTypeface>>

Tries to get a glyph typeface for specified typeface.

Returns the glyph typeface if the font manager could create it, None otherwise.

Source

pub fn add_font_collection(&self, font_collection: Rc<dyn IFontCollection>)

Add a font collection to the manager.

If a font collection’s key is already present the collection is replaced (and the replaced collection disposed).

Panics when the key of the collection does not follow the fonts: scheme.

Source

pub fn remove_font_collection(&self, key: &Uri)

Removes the font collection that corresponds to specified key.

Source

pub fn try_match_character( &self, codepoint: i32, font_style: FontStyle, font_weight: FontWeight, font_stretch: FontStretch, font_family: Option<&FontFamily>, culture: Option<&CultureInfo>, ) -> Option<Typeface>

Tries to match a specified character to a Typeface that supports specified font properties.

font_family is optional and used for fallback lookup.

Returns the matching typeface if the font manager could match the character to specified parameters, None otherwise.

Source

pub fn get_family_typefaces(&self, font_family: &FontFamily) -> Vec<Typeface>

The typefaces of a font family; empty when the family is unknown.

Internal upstream, where the Skia unit tests see it; public here so that the tests of the Skia crate reach it.

Source

pub fn dispose(&self)

Disposes every font collection and the font backend.

Trait Implementations§

Source§

impl MarkupTyped for FontManager

Source§

const MARKUP: &'static MarkupType

The markup metadata of the type.
Source§

impl PartialEq for FontManager

Font managers compare by reference, so that a handle can be an untyped value (the value of the static member markup names).

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

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> AnyValue for T
where T: PartialEq + 'static,

Source§

fn any_value_as_any(&self) -> &(dyn Any + 'static)

Source§

fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool

Source§

fn any_value_type_name(&self) -> &'static str

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> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.