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:
- Collect all lookups for a given set of scripts and features. https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/autofit/afshaper.c#L174
- For each lookup, collect all output glyphs. https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/autofit/afshaper.c#L201
- 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>
impl<'a, 'b> GsubHandler<'a, 'b>
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
fn process_lookup( &mut self, lookup_index: u16, ) -> Result<(), ProcessLookupError>
fn process_lookup_inner( &mut self, lookup_index: u16, ) -> Result<(), ProcessLookupError>
Sourcefn finish(self) -> Option<Range<usize>>
fn finish(self) -> Option<Range<usize>>
Finishes processing for this set of GSUB lookups and returns the range of touched glyphs.
Sourcefn check_blue_coverage(
&mut self,
coverage: Result<CoverageTable<'a>, ReadError>,
)
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.
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more