pub struct OutlineTables<'a> {
pub glyf: Glyf<'a>,
pub loca: Loca<'a>,
pub gvar: Option<SelectedGvar<'a>>,
pub hmtx: Option<GlyphMetricRecords<'a>>,
pub os2: Option<Os2<'a>>,
pub hvar: Option<Hvar<'a>>,
pub units_per_em: u16,
pub(super) coords: &'a [F2Dot14],
pub(super) gvar_scalars: &'a [Fixed],
}Expand description
An OutlineContext that reads the tables from a font.
new reads at the default instance and at
selects a location. Nothing is cached between glyphs; a caller reading many
glyphs at one location is better served by a context that caches.
Fields§
§glyf: Glyf<'a>Glyph outlines.
loca: Loca<'a>The index into Self::glyf.
gvar: Option<SelectedGvar<'a>>Glyph variations, absent if the font does not vary.
hmtx: Option<GlyphMetricRecords<'a>>Source of the metrics for the first two phantom points.
os2: Option<Os2<'a>>Supplies the ascender and descender for the last two.
hvar: Option<Hvar<'a>>Only its presence is read: it changes how deltas apply to phantom points.
units_per_em: u16Design units per em, from head.
coords: &'a [F2Dot14]Not public, with gvar_scalars: the two are only correct together,
and at is what keeps them so.
gvar_scalars: &'a [Fixed]Implementations§
Source§impl<'a> OutlineTables<'a>
impl<'a> OutlineTables<'a>
Sourcepub fn new(font: &impl TableProvider<'a>) -> Result<Self, ReadError>
pub fn new(font: &impl TableProvider<'a>) -> Result<Self, ReadError>
Reads the tables from a font.
Fails if glyf, loca or head is missing or malformed. The rest are
optional: without gvar the font is treated as non-variable, and
without hmtx or OS/2 the corresponding phantom point metrics are
zero.
Sourcepub fn at(self, coords: &'a [F2Dot14], gvar_scalars: &'a [Fixed]) -> Self
pub fn at(self, coords: &'a [F2Dot14], gvar_scalars: &'a [Fixed]) -> Self
Reads at coords instead of the default instance.
gvar_scalars are the shared tuple scalars for coords, from
SelectedGvar::compute_scalars; pass &[] to compute them per glyph
instead. They are taken together because scalars for another location
produce wrong deltas and nothing can detect it.
Trait Implementations§
Source§impl<'a> Clone for OutlineTables<'a>
impl<'a> Clone for OutlineTables<'a>
Source§fn clone(&self) -> OutlineTables<'a>
fn clone(&self) -> OutlineTables<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> OutlineContext<'a> for OutlineTables<'a>
impl<'a> OutlineContext<'a> for OutlineTables<'a>
Source§fn glyph(&self, glyph: GlyphId) -> Option<LocaGlyph<'a>>
fn glyph(&self, glyph: GlyphId) -> Option<LocaGlyph<'a>>
None if it is empty.Source§fn glyph_variation_data(&self, glyph: GlyphId) -> Option<GlyphVariationData<'a>>
fn glyph_variation_data(&self, glyph: GlyphId) -> Option<GlyphVariationData<'a>>
None if the font does not vary or the
glyph has none.Source§fn has_gvar(&self) -> bool
fn has_gvar(&self) -> bool
gvar table, whatever any one glyph has in it. Read moreSource§fn phantom_point_deltas(&self, glyph: GlyphId) -> Option<[Point<Fixed>; 4]>
fn phantom_point_deltas(&self, glyph: GlyphId) -> Option<[Point<Fixed>; 4]>
Source§fn coords(&self) -> &[F2Dot14]
fn coords(&self) -> &[F2Dot14]
Source§fn gvar_scalars(&self) -> &[Fixed]
fn gvar_scalars(&self) -> &[Fixed]
gvar’s shared tuples at Self::coords, as
SelectedGvar::compute_scalars fills them. Read more