Struct GsubHandler

Source
struct GsubHandler<'a, 'b> {
    charmap: &'a Charmap<'a>,
    lookup_list: &'a SubstitutionLookupList<'a>,
    style: &'a StyleClass,
    glyph_styles: &'a mut [GlyphStyle],
    need_blue_substs: bool,
    min_gid: usize,
    max_gid: usize,
    lookup_depth: usize,
    visited_set: &'a mut VisitedLookupSet<'b>,
}
Expand description

Captures glyphs from the GSUB table that aren’t present in cmap.

FreeType does this in a few phases:

  1. Collect all lookups for a given set of scripts and features. https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/autofit/afshaper.c#L174
  2. For each lookup, collect all output glyphs. https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/autofit/afshaper.c#L201
  3. If the style represents a specific feature, make sure at least one of the characters in the associated blue string would be substituted by those lookups. If none would be substituted, then we don’t assign the style to any glyphs because we don’t have any modified alignment zones. https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/autofit/afshaper.c#L264

We roll these into one pass over the lookups below so that we don’t have to allocate a lookup set or iterate them twice. Note that since substitutions are checked for individual characters, we ignore ligatures and contextual lookups (and alternates since they aren’t applicable).

Fields§

§charmap: &'a Charmap<'a>§lookup_list: &'a SubstitutionLookupList<'a>§style: &'a StyleClass§glyph_styles: &'a mut [GlyphStyle]§need_blue_substs: bool§min_gid: usize§max_gid: usize§lookup_depth: usize§visited_set: &'a mut VisitedLookupSet<'b>

Implementations§

Source§

impl<'a, 'b> GsubHandler<'a, 'b>

Source

fn new( charmap: &'a Charmap<'a>, lookup_list: &'a SubstitutionLookupList<'_>, style: &'a StyleClass, glyph_styles: &'a mut [GlyphStyle], visited_set: &'a mut VisitedLookupSet<'b>, ) -> Self

Source

fn process_lookup( &mut self, lookup_index: u16, ) -> Result<(), ProcessLookupError>

Source

fn process_lookup_inner( &mut self, lookup_index: u16, ) -> Result<(), ProcessLookupError>

Source

fn finish(self) -> Option<Range<usize>>

Finishes processing for this set of GSUB lookups and returns the range of touched glyphs.

Source

fn check_blue_coverage( &mut self, coverage: Result<CoverageTable<'a>, ReadError>, )

Checks the given coverage table for any characters in the blue strings associated with our current style.

Source

fn capture_glyph(&mut self, gid: u32)

Auto Trait Implementations§

§

impl<'a, 'b> Freeze for GsubHandler<'a, 'b>

§

impl<'a, 'b> RefUnwindSafe for GsubHandler<'a, 'b>

§

impl<'a, 'b> !Send for GsubHandler<'a, 'b>

§

impl<'a, 'b> !Sync for GsubHandler<'a, 'b>

§

impl<'a, 'b> Unpin for GsubHandler<'a, 'b>

§

impl<'a, 'b> !UnwindSafe for GsubHandler<'a, 'b>

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.