pub enum FontOrRef<T> {
Font(T),
Ref(FontRef),
}Expand description
Enum that wraps either a fontconfig-resolved font (T) or a direct FontRef.
This allows the shaping code to handle both fontconfig-resolved fonts and embedded fonts (FontRef) uniformly through the ParsedFontTrait interface.
Variants§
Font(T)
A font loaded via fontconfig
Ref(FontRef)
A direct FontRef (embedded font, bypasses fontconfig)
Trait Implementations§
Source§impl<T: ParsedFontTrait> ParsedFontTrait for FontOrRef<T>
impl<T: ParsedFontTrait> ParsedFontTrait for FontOrRef<T>
fn shape_text( &self, text: &str, script: Script, language: Language, direction: BidiDirection, style: &StyleProperties, ) -> Result<Vec<Glyph>, LayoutError>
Source§fn get_hash(&self) -> u64
fn get_hash(&self) -> u64
Hash of the font, necessary for breaking layouted glyphs into glyph runs
fn get_glyph_size(&self, glyph_id: u16, font_size: f32) -> Option<LogicalSize>
fn get_hyphen_glyph_and_advance(&self, font_size: f32) -> Option<(u16, f32)>
fn get_kashida_glyph_and_advance(&self, font_size: f32) -> Option<(u16, f32)>
fn has_glyph(&self, codepoint: u32) -> bool
fn get_vertical_metrics(&self, glyph_id: u16) -> Option<VerticalMetrics>
fn get_font_metrics(&self) -> LayoutFontMetrics
fn num_glyphs(&self) -> u16
Source§impl<T: ParsedFontTrait> ShallowClone for FontOrRef<T>
impl<T: ParsedFontTrait> ShallowClone for FontOrRef<T>
Source§fn shallow_clone(&self) -> Self
fn shallow_clone(&self) -> Self
Create a shallow clone (increment reference count, don’t copy data)
Auto Trait Implementations§
impl<T> Freeze for FontOrRef<T>where
T: Freeze,
impl<T> RefUnwindSafe for FontOrRef<T>where
T: RefUnwindSafe,
impl<T> Send for FontOrRef<T>where
T: Send,
impl<T> Sync for FontOrRef<T>where
T: Sync,
impl<T> Unpin for FontOrRef<T>where
T: Unpin,
impl<T> UnwindSafe for FontOrRef<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