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.
Members
FONT_COLLECTION_SCHEMESYSTEM_FONT_SCHEMECOMPOSITE_FONT_SCHEMEsystem_fonts_keycurrentdefault_font_familysystem_fontstry_get_glyph_typefaceinvalidate_glyph_typefacesadd_font_collectionremove_font_collectiontry_match_characterget_family_typefacesdispose
FONT_COLLECTION_SCHEME
const FONT_COLLECTION_SCHEME: &'static str
SYSTEM_FONT_SCHEME
const SYSTEM_FONT_SCHEME: &'static str
COMPOSITE_FONT_SCHEME
const COMPOSITE_FONT_SCHEME: &'static str
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.
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.
default_font_family
fn default_font_family(self: &Self) -> &FontFamily
Gets the system's default font family.
system_fonts
fn system_fonts(self: &Self) -> Rc<dyn IFontCollection>
Get all system fonts.
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.
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.
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.
remove_font_collection
fn remove_font_collection(self: &Self, key: &url::Url)
Removes the font collection that corresponds to specified key.
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.
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.
dispose
fn dispose(self: &Self)
Disposes every font collection and the font backend.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeAnyValueClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyErasedDestructorIntoEitherPartialEqMarkupTypedValueTypeRegistration
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.