TrueTypeFont

Struct TrueTypeFont 

Source
pub struct TrueTypeFont {
    pub glyf_table: Vec<GlyfOutline>,
    pub cmap_table: CmapTable,
    pub post_table: PostTable,
    pub name_table: NameTable,
}
Expand description

The raw data from a TrueType font
Contains only the subset of the table needed for mapping unicode:

  • Codepoints
  • Glyph indices
  • Glyph names
  • Glyph outlines

Fields§

§glyf_table: Vec<GlyfOutline>

The glyph outlines in the font, indexed by glyph_id

§cmap_table: CmapTable

The CMAP table of the font

§post_table: PostTable

The Post table of the font

§name_table: NameTable

The Name table of the font

Implementations§

Source§

impl TrueTypeFont

Source

pub fn new(font_data: &[u8]) -> Result<TrueTypeFont, ParseError>

Creates a new TrueType font from the given font data

§Errors

Returns an error if the font data is invalid or cannot be parsed

Trait Implementations§

Source§

impl Debug for TrueTypeFont

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl From<TrueTypeFont> for Font

Source§

fn from(value: TrueTypeFont) -> Font

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.