pub struct FontRegistry { /* private fields */ }Expand description
A font registry that maps font family + weight + style to font data.
Implementations§
Source§impl FontRegistry
impl FontRegistry
pub fn new() -> Self
Sourcepub fn resolve(&self, families: &str, weight: u32, italic: bool) -> &FontData
pub fn resolve(&self, families: &str, weight: u32, italic: bool) -> &FontData
Look up a font by family name (or comma-separated fallback chain), falling back to Helvetica if none match.
Supports CSS-style font family lists: "Inter, Helvetica" tries Inter
first, then Helvetica. Quoted families are unquoted automatically.
Sourcepub fn resolve_for_char(
&self,
families: &str,
ch: char,
weight: u32,
italic: bool,
) -> (&FontData, String)
pub fn resolve_for_char( &self, families: &str, ch: char, weight: u32, italic: bool, ) -> (&FontData, String)
Resolve a font for a specific character from a comma-separated fallback chain.
Walks the families in order, returning the first font that has a glyph for ch.
Falls back to Helvetica if no font covers the character.
Returns a tuple of (font_data, resolved_single_family_name).
Trait Implementations§
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