FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    FontManager

    struct · ferroui-base · v0.5.0

    struct FontManager
    

    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.

    View source

    Members

    FONT_COLLECTION_SCHEME

    const FONT_COLLECTION_SCHEME: &'static str
    

    Source

    SYSTEM_FONT_SCHEME

    const SYSTEM_FONT_SCHEME: &'static str
    

    Source

    COMPOSITE_FONT_SCHEME

    const COMPOSITE_FONT_SCHEME: &'static str
    

    Source

    system_fonts_key

    fn system_fonts_key() -> url::Url
    

    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

    current

    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

    default_font_family

    fn default_font_family(self: &Self) -> &FontFamily
    

    Gets the system's default font family.

    Source

    system_fonts

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

    Get all system fonts.

    Source

    try_get_glyph_typeface

    fn try_get_glyph_typeface(self: &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.

    The glyph typeface found for a typeface is kept until a font collection gains a glyph typeface or a collection is added or removed; a collection that does not derive from FontCollectionBase and changes what it returns calls invalidate_glyph_typefaces.

    Source

    invalidate_glyph_typefaces

    fn invalidate_glyph_typefaces(self: &Self)
    

    Makes this font manager look every glyph typeface up again: for a font collection that does not derive from FontCollectionBase and whose glyph typefaces changed.

    Source

    add_font_collection

    fn add_font_collection(self: &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

    remove_font_collection

    fn remove_font_collection(self: &Self, key: &url::Url)
    

    Removes the font collection that corresponds to specified key.

    Source

    try_match_character

    fn try_match_character(self: &Self, codepoint: i32, font_style: FontStyle, font_weight: FontWeight, font_stretch: FontStretch, font_family: Option<&FontFamily>, culture: Option<&Locale>) -> 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

    get_family_typefaces

    fn get_family_typefaces(self: &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

    dispose

    fn dispose(self: &Self)
    

    Disposes every font collection and the font backend.

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.