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
impl FontManager
pub const FONT_COLLECTION_SCHEME: &'static str = "fonts"
pub const SYSTEM_FONT_SCHEME: &'static str = "systemfont"
pub const COMPOSITE_FONT_SCHEME: &'static str = "compositefont"
Sourcepub fn system_fonts_key() -> Uri
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.
Sourcepub fn new(platform_impl: Rc<dyn IFontManagerImpl>) -> Rc<FontManager>
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.
Sourcepub fn current() -> Rc<FontManager>
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.
Sourcepub fn default_font_family(&self) -> &FontFamily
pub fn default_font_family(&self) -> &FontFamily
Gets the system’s default font family.
Sourcepub fn system_fonts(&self) -> Rc<dyn IFontCollection>
pub fn system_fonts(&self) -> Rc<dyn IFontCollection>
Get all system fonts.
Sourcepub fn platform_impl(&self) -> &Rc<dyn IFontManagerImpl>
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.
Sourcepub fn try_get_glyph_typeface(
&self,
typeface: &Typeface,
) -> Option<Rc<GlyphTypeface>>
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.
Sourcepub fn add_font_collection(&self, font_collection: Rc<dyn IFontCollection>)
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.
Sourcepub fn remove_font_collection(&self, key: &Uri)
pub fn remove_font_collection(&self, key: &Uri)
Removes the font collection that corresponds to specified key.
Sourcepub 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>
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.
Sourcepub fn get_family_typefaces(&self, font_family: &FontFamily) -> Vec<Typeface>
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.
Trait Implementations§
Source§impl MarkupTyped for FontManager
impl MarkupTyped for FontManager
Source§const MARKUP: &'static MarkupType
const MARKUP: &'static MarkupType
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).
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).
Auto Trait Implementations§
impl !Freeze for FontManager
impl !RefUnwindSafe for FontManager
impl !Send for FontManager
impl !Sync for FontManager
impl !UnwindSafe for FontManager
impl Unpin for FontManager
impl UnsafeUnpin for FontManager
Blanket Implementations§
Source§impl<T> AnyValue for Twhere
T: PartialEq + 'static,
impl<T> AnyValue for Twhere
T: PartialEq + 'static,
fn any_value_as_any(&self) -> &(dyn Any + 'static)
fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool
fn any_value_type_name(&self) -> &'static str
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more