pub struct FontFace { /* private fields */ }Expand description
A font face that materialises glyphs on demand.
Implementations§
Source§impl FontFace
impl FontFace
Sourcepub fn from_bytes(data: Arc<Vec<u8>>, index: u32) -> Option<Self>
pub fn from_bytes(data: Arc<Vec<u8>>, index: u32) -> Option<Self>
Parse the face at index of data, keeping the bytes alive for
the outline loads that follow. None when the face does not
parse or declares a zero em square.
pub fn units_per_em(&self) -> f32
Sourcepub fn data(&self) -> &Arc<Vec<u8>>
pub fn data(&self) -> &Arc<Vec<u8>>
The font file the face was parsed from; HarfBuzz shapes against it.
Sourcepub fn face_index(&self) -> u32
pub fn face_index(&self) -> u32
The face’s index in its file (0 unless the file is a collection).
pub fn scale_factor(&self, px: f32) -> f32
Sourcepub fn lookup_glyph_index(&self, ch: char) -> u16
pub fn lookup_glyph_index(&self, ch: char) -> u16
Glyph index for ch, or 0 when the face has no glyph for it.
pub fn horizontal_line_metrics(&self, px: f32) -> Option<LineMetrics>
pub fn metrics(&self, ch: char, px: f32) -> Metrics
pub fn metrics_indexed(&self, id: u16, px: f32) -> Metrics
Sourcepub fn rasterize_indexed(&self, id: u16, px: f32) -> (Metrics, Vec<u8>)
pub fn rasterize_indexed(&self, id: u16, px: f32) -> (Metrics, Vec<u8>)
Coverage bitmap for id at px, row-major from the top-left
corner, alongside its placement.
Sourcepub fn color_glyph(&self, id: u16) -> Option<Arc<ColorGlyph>>
pub fn color_glyph(&self, id: u16) -> Option<Arc<ColorGlyph>>
The colour image glyph id is drawn with instead of an outline (an emoji in a CBDT or sbix font), decoded once from the face’s largest strike.
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 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
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
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.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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