read_fonts::tables::hmtx

Type Alias Hmtx

Source
pub type Hmtx<'a> = TableRef<'a, HmtxMarker>;
Expand description

Aliased Type§

struct Hmtx<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> Hmtx<'a>

Source

pub fn read( data: FontData<'a>, number_of_h_metrics: u16, num_glyphs: u16, ) -> Result<Self, ReadError>

A constructor that requires additional arguments.

This type requires some external state in order to be parsed.

Source§

impl<'a> Hmtx<'a>

Source

pub fn h_metrics(&self) -> &'a [LongMetric]

Paired advance width/height and left/top side bearing values for each glyph. Records are indexed by glyph ID.

Source

pub fn left_side_bearings(&self) -> &'a [BigEndian<i16>]

Leading (left/top) side bearings for glyph IDs greater than or equal to numberOfLongMetrics.

Source§

impl Hmtx<'_>

Source

pub fn advance(&self, glyph_id: GlyphId) -> Option<u16>

Returns the advance width for the given glyph identifier.

Source

pub fn side_bearing(&self, glyph_id: GlyphId) -> Option<i16>

Returns the left side bearing for the given glyph identifier.

Source§

impl<'a, T> TableRef<'a, T>

Source

pub fn resolve_offset<O: Offset, R: FontRead<'a>>( &self, offset: O, ) -> Result<R, ReadError>

Resolve the provided offset from the start of this table.

Source

pub fn offset_data(&self) -> FontData<'a>

Return a reference to this table’s raw data.

We use this in the compile crate to resolve offsets.

Source

pub fn shape(&self) -> &T

Return a reference to the table’s ‘Shape’ struct.

This is a low level implementation detail, but it can be useful in some cases where you want to know things about a table’s layout, such as the byte offsets of specific fields.

Trait Implementations§

Source§

impl<'a> FontReadWithArgs<'a> for Hmtx<'a>

Source§

fn read_with_args( data: FontData<'a>, args: &(u16, u16), ) -> Result<Self, ReadError>

read an item, using the provided args. Read more
Source§

impl ReadArgs for Hmtx<'_>

Source§

type Args = (u16, u16)

Source§

impl TopLevelTable for Hmtx<'_>

Source§

const TAG: Tag

hmtx

Source§

impl<'a, T: Clone> Clone for TableRef<'a, T>

Source§

fn clone(&self) -> TableRef<'a, T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more