pub struct FontFace { /* private fields */ }Expand description
One owned TTF/OpenType outline face (collection index zero).
Source bytes are retained once inside ab_glyph; rustybuzz borrows those bytes while shaping. The source Vec capacity is checked before parsing. Font discovery, fallback selection, variable-font axes, color/bitmap glyphs, wrapping and bidi paragraph layout are outside this API. Cloning shares the original bytes and parsed font without copying them.
Implementations§
Source§impl FontFace
impl FontFace
Sourcepub fn from_bytes(
bytes: Vec<u8>,
budget: FontBudget,
) -> Result<FontFace, FontError>
pub fn from_bytes( bytes: Vec<u8>, budget: FontBudget, ) -> Result<FontFace, FontError>
Loads already-read TTF/OTF bytes without duplicating their backing storage. The caller owns filesystem/network I/O and font licensing.
Sourcepub fn font_data(&self) -> &[u8] ⓘ
pub fn font_data(&self) -> &[u8] ⓘ
Original font bytes, borrowed without an additional owned copy.
Sourcepub const fn allocation_bytes(&self) -> usize
pub const fn allocation_bytes(&self) -> usize
Source Vec capacity referenced by this handle; clones share it. Dependency-parsed metadata is excluded.
Sourcepub const fn glyph_count(&self) -> usize
pub const fn glyph_count(&self) -> usize
Number of font-local glyph identifiers, including the missing-glyph entry.
Sourcepub fn shape_line(
&self,
text: &str,
style: &TextStyle,
budget: &TextLayoutBudget,
) -> Result<ShapedLine, FontError>
pub fn shape_line( &self, text: &str, style: &TextStyle, budget: &TextLayoutBudget, ) -> Result<ShapedLine, FontError>
Shapes a horizontal single-script directional run at baseline (0, 0).
Positions/advances use logical pixels, with positive y downward. Kerning, ligatures and combining-mark offsets come from rustybuzz/OpenType tables. Auto infers one direction/script, not a mixed-direction bidi paragraph. Newlines, controls and missing glyphs return errors; spaces retain advance. DPI changes raster resolution, not logical layout or kerning decisions.
Sourcepub fn rasterize_glyph(
&self,
glyph_id: u16,
style: &TextStyle,
budget: &TextLayoutBudget,
) -> Result<RasterizedGlyph, FontError>
pub fn rasterize_glyph( &self, glyph_id: u16, style: &TextStyle, budget: &TextLayoutBudget, ) -> Result<RasterizedGlyph, FontError>
Rasterizes one glyph at physical em size and baseline (0, 0).
Outlines are preflighted without allocating curves; pixel bounds and
command counts are checked before bounded curve and coverage allocations.
No hinting or subpixel-position variants are applied. Empty outlines
(for example spaces) return an empty bitmap, not a missing-glyph error.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FontFace
impl RefUnwindSafe for FontFace
impl Send for FontFace
impl Sync for FontFace
impl Unpin for FontFace
impl UnsafeUnpin for FontFace
impl UnwindSafe for FontFace
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.