Skip to main content

GlyfContext

Struct GlyfContext 

Source
pub(crate) struct GlyfContext<'a> {
    pub(crate) font: &'a Font,
    tables: &'a (Glyf<'a>, Loca<'a>),
    gvar: Option<&'a SelectedGvar<'a>>,
    h_metrics: &'a GlyphMetricRecords<'a>,
    v_metrics: &'a GlyphMetricRecords<'a>,
    coords: &'a [F2Dot14],
    gvar_scalars: &'a [Fixed],
    h_line: (i32, i32),
    num_glyphs: u32,
    units_per_em: u16,
    has_hvar: bool,
}
Expand description

The tables, location and scalars a glyf outline loads from, looked up once for a font.

Loading asks for these for every glyph, so a draw reads them from here rather than from the font’s caches each time.

Fields§

§font: &'a Font§tables: &'a (Glyf<'a>, Loca<'a>)§gvar: Option<&'a SelectedGvar<'a>>§h_metrics: &'a GlyphMetricRecords<'a>§v_metrics: &'a GlyphMetricRecords<'a>§coords: &'a [F2Dot14]§gvar_scalars: &'a [Fixed]§h_line: (i32, i32)

The ascender and descender that place vertical phantom points for a font with no vertical metrics.

§num_glyphs: u32§units_per_em: u16§has_hvar: bool

Implementations§

Source§

impl<'a> GlyfContext<'a>

Source

pub(crate) fn new(font: &'a Font) -> Option<Self>

Returns the context for font, or None if it has no glyf table.

Source

fn metrics( &self, records: &GlyphMetricRecords<'_>, glyph: GlyphId, ) -> (i32, i32)

Returns the bearing and advance in records for glyph.

Trait Implementations§

Source§

impl<'a> Clone for GlyfContext<'a>

Source§

fn clone(&self) -> GlyfContext<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for GlyfContext<'a>

Source§

impl<'a> OutlineContext<'a> for GlyfContext<'a>

Source§

fn glyph(&self, glyph: GlyphId) -> Option<LocaGlyph<'a>>

Returns the glyph with the given identifier, or None if it is empty.
Source§

fn glyph_variation_data(&self, glyph: GlyphId) -> Option<GlyphVariationData<'a>>

Variation data for a glyph, or None if the font does not vary or the glyph has none.
Source§

fn has_gvar(&self) -> bool

True if the font has a gvar table, whatever any one glyph has in it. Read more
Source§

fn phantom_point_deltas(&self, glyph: GlyphId) -> Option<[Point<Fixed>; 4]>

Variation deltas for a glyph’s four phantom points. Read more
Source§

fn gvar_scalars(&self) -> &[Fixed]

Scalars for gvar’s shared tuples at Self::coords, as SelectedGvar::compute_scalars fills them. Read more
Source§

fn coords(&self) -> &[F2Dot14]

Normalized variation coordinates, empty for the default instance. Read more
Source§

fn units_per_em(&self) -> u16

Design units per em.
Source§

fn h_metrics(&self, glyph: GlyphId) -> (i32, i32)

Left side bearing and advance width, in font units. Read more
Source§

fn v_metrics(&self, glyph: GlyphId) -> Option<(i32, i32)>

Top side bearing and vertical advance for a glyph, in font units. Read more
Source§

fn h_line_metrics(&self) -> (i32, i32)

The ascender and descender of the line horizontal text sits on, in font units. Read more
Source§

fn has_hvar(&self) -> bool

True if the font has an HVAR table. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for GlyfContext<'a>

§

impl<'a> !UnwindSafe for GlyfContext<'a>

§

impl<'a> Freeze for GlyfContext<'a>

§

impl<'a> Send for GlyfContext<'a>

§

impl<'a> Sync for GlyfContext<'a>

§

impl<'a> Unpin for GlyfContext<'a>

§

impl<'a> UnsafeUnpin for GlyfContext<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.