pub struct FontRegistry { /* private fields */ }Expand description
Registry of loaded fonts keyed by font stack names.
A “font stack” is a comma-separated list of font family names
(e.g. "Noto Sans Regular, Arial Unicode MS Bold"). The registry
resolves the first available font for each stack.
Implementations§
Source§impl FontRegistry
impl FontRegistry
Sourcepub fn register(&mut self, family_name: impl Into<String>, font: OwnedFont)
pub fn register(&mut self, family_name: impl Into<String>, font: OwnedFont)
Register a font under a family name.
Sourcepub fn font_count(&self) -> usize
pub fn font_count(&self) -> usize
How many individual fonts are registered.
Sourcepub fn resolve_stack(&mut self, font_stack: &str) -> Option<&str>
pub fn resolve_stack(&mut self, font_stack: &str) -> Option<&str>
Resolve a font stack to the first available font.
Returns the family name of the resolved font, or None if no font
in the stack is registered.
Trait Implementations§
Source§impl Clone for FontRegistry
impl Clone for FontRegistry
Source§fn clone(&self) -> FontRegistry
fn clone(&self) -> FontRegistry
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FontRegistry
impl Debug for FontRegistry
Source§impl Default for FontRegistry
impl Default for FontRegistry
Source§fn default() -> FontRegistry
fn default() -> FontRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for FontRegistry
impl RefUnwindSafe for FontRegistry
impl Send for FontRegistry
impl Sync for FontRegistry
impl Unpin for FontRegistry
impl UnsafeUnpin for FontRegistry
impl UnwindSafe for FontRegistry
Blanket Implementations§
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
Mutably borrows from an owned value. Read more