[−][src]Struct ttf_parser::Font
A font data handle.
Methods
impl<'a> Font<'a>[src]
pub fn glyph_index(&self, c: char) -> Result<u16, Error>[src]
Resolves Glyph ID for code point.
Returns Error::NoGlyph instead of 0 when glyph is not found.
impl<'a> Font<'a>[src]
impl<'a> Font<'a>[src]
pub fn glyph_hor_metrics(&self, glyph_id: u16) -> Option<HorizontalMetrics>[src]
Returns glyph's horizontal metrics.
Returns None when font doesn't have such glyph_id.
impl<'a> Font<'a>[src]
pub fn underline_metrics(&self) -> LineMetrics[src]
Parses font's underline metrics set in the post table.
impl<'a> Font<'a>[src]
pub fn units_per_em(&self) -> Option<u16>[src]
Returns font's units per EM set in the head table.
Returns None if value is not in a 16..16384 range.
impl<'a> Font<'a>[src]
pub fn ascender(&self) -> i16[src]
Returns font's ascender set in the hhea table.
pub fn descender(&self) -> i16[src]
Returns font's descender set in the hhea table.
pub fn height(&self) -> i16[src]
Returns font's height.
pub fn line_gap(&self) -> i16[src]
Returns font's line gap set in the hhea table.
impl<'a> Font<'a>[src]
pub fn from_data(data: &'a [u8], index: u32) -> Result<Self, Error>[src]
Creates a Font object from raw data.
You can set index in case of font collections.
For simple ttf fonts set index to 0.
This function only parses font tables, so it's relatively light.
Required tables: cmap, glyp, head, hhea, hmtx, loca, post.
Optional tables: GDEF, name, OS/2
pub fn number_of_glyphs(&self) -> u16[src]
Returns a total number of glyphs in the font.
The value was already parsed, so this function doesn't involve any parsing.
pub fn is_valid(&self) -> Result<(), Error>[src]
Checks tables checksum.
Checks only used tables.
pub fn os2_table(&self) -> Option<Table>[src]
Returns a handle to a OS/2 table.
pub fn name_table(&self) -> Option<Table>[src]
Returns a handle to a name table.
pub fn gdef_table(&self) -> Option<Table>[src]
Returns a handle to a GDEF table.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> From<T> for T[src]
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,