pub struct LoadedFonts<T> {
pub fonts: HashMap<FontId, T>,
/* private fields */
}Expand description
A map of pre-loaded fonts, keyed by FontId (from rust-fontconfig)
This is passed to the shaper - no font loading happens during shaping The fonts are loaded BEFORE layout based on the font chains and text content.
Provides both FontId and hash-based lookup for efficient glyph operations.
Fields§
§fonts: HashMap<FontId, T>Primary storage: FontId -> Font
Implementations§
Source§impl<T: ParsedFontTrait> LoadedFonts<T>
impl<T: ParsedFontTrait> LoadedFonts<T>
pub fn new() -> Self
Sourcepub fn get_by_hash(&self, hash: u64) -> Option<&T>
pub fn get_by_hash(&self, hash: u64) -> Option<&T>
Get a font by its hash
Sourcepub fn get_font_id_by_hash(&self, hash: u64) -> Option<&FontId>
pub fn get_font_id_by_hash(&self, hash: u64) -> Option<&FontId>
Get the FontId for a hash
Sourcepub fn contains_key(&self, font_id: &FontId) -> bool
pub fn contains_key(&self, font_id: &FontId) -> bool
Check if a FontId is present
Sourcepub fn contains_hash(&self, hash: u64) -> bool
pub fn contains_hash(&self, hash: u64) -> bool
Check if a hash is present
Trait Implementations§
Source§impl<T: Clone> Clone for LoadedFonts<T>
impl<T: Clone> Clone for LoadedFonts<T>
Source§fn clone(&self) -> LoadedFonts<T>
fn clone(&self) -> LoadedFonts<T>
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<T: Debug> Debug for LoadedFonts<T>
impl<T: Debug> Debug for LoadedFonts<T>
Source§impl<T: ParsedFontTrait> Default for LoadedFonts<T>
impl<T: ParsedFontTrait> Default for LoadedFonts<T>
Source§impl<T: ParsedFontTrait> FromIterator<(FontId, T)> for LoadedFonts<T>
impl<T: ParsedFontTrait> FromIterator<(FontId, T)> for LoadedFonts<T>
Auto Trait Implementations§
impl<T> Freeze for LoadedFonts<T>
impl<T> RefUnwindSafe for LoadedFonts<T>where
T: RefUnwindSafe,
impl<T> Send for LoadedFonts<T>where
T: Send,
impl<T> Sync for LoadedFonts<T>where
T: Sync,
impl<T> Unpin for LoadedFonts<T>where
T: Unpin,
impl<T> UnwindSafe for LoadedFonts<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more