Skip to main content

Module context

Module context 

Source
Expand description

Contextual and chained contextual subtables, shared by GSUB and GPOS.

A contextual subtable is a chained one without backtrack or lookahead, so both run through the same walks. Only the layout of their rules differs, which RuleLayout records: whether they are chained, and the width of the offsets to them, which the extended formats widen.

Rule values are glyph IDs or classes. The rule walks take their width as a constant, since they read many values per rule: classes are always 16 bits, and only the glyph rules of the extended formats are 24.

StructsΒ§

ChainClassCaches πŸ”’
Caches of the input and lookahead classes of a glyph.
ChainContext1 πŸ”’
Chained context by glyph sequences, or context by glyph sequences.
ChainContext2 πŸ”’
Chained context by glyph class sequences, or context by glyph class sequences.
ChainContext3 πŸ”’
Chained context by a coverage per glyph, or context by a coverage per glyph.
ChainMatchers πŸ”’
How a chain rule matches each of its three sequences.
Lookahead πŸ”’
The glyphs after the current one that rules are pre-matched against.
ParsedRule πŸ”’
A rule’s fields, parsed in one pass. Glyph IDs and classes are both read as plain values of W bytes; a sequence rule has no backtrack or lookahead.
RuleLayout πŸ”’
How the rules of a subtable are laid out.
RuleProbe πŸ”’
Reads the values of a rule that the pre-match needs, without parsing the rule.
Rules πŸ”’
The rules of a rule set, read on demand from their offsets.
SyllableSlot πŸ”’
Where a glyph’s class is kept in its syllable byte while a lookup applies: in the bits of unknown shifted left by shift, where the value unknown means the class isn’t known yet.

EnumsΒ§

Prematch πŸ”’
What the pre-match found after the current glyph.

ConstantsΒ§

CLASS πŸ”’
The width of the class values of a rule, and of the glyph IDs of the original formats.
GLYPH24 πŸ”’
The width of the glyph IDs of the extended formats.
NARROW πŸ”’
The width of glyph IDs, classes and offsets in the original formats.
WIDE πŸ”’
The width of glyph IDs and offsets in the extended formats.

TraitsΒ§

Matcher πŸ”’
Matches a glyph against a rule value in a rule walk.

FunctionsΒ§

apply_chain_rules πŸ”’
Applies the first rule of a rule set that matches.
cached_class πŸ”’
The class of gid, remembered in cache if there is one.
finish_rules πŸ”’
Marks the range a rule walk depended on, then returns its result.
for_each_rule πŸ”’
Calls f with each rule of each rule set present in sets, stopping with None at one that can’t be read.
glyph_seconds πŸ”’
The glyphs that may follow the first one in a match of a glyph rule.
matches_at πŸ”’
Whether the glyph at idx matches value; a glyph outside the buffer never matches.
prematch πŸ”’
Finds the glyphs that rules are pre-matched against. The context iterator, unlike the input one, doesn’t skip default ignorables. https://github.com/harfbuzz/harfbuzz/issues/4813
rule_first_input πŸ”’
The first input value of a rule, after any backtrack: the second glyph of a match.
rule_set πŸ”’
Rule set index of sets, or None if it is null or can’t be read.
rule_set_digests πŸ”’
The digest of the first input class of each rule set’s rules.
sequence_matches πŸ”’
Whether the glyph matches value index of sequence.
sequence_would_apply πŸ”’
Whether input matches the glyphs of ctx after the first.
skip_rules πŸ”’
Returns the index of the first rule after index whose first input isn’t first. Rules are sorted by it, so the ones skipped would fail the same way; unreadable rules are skipped too.
would_apply_chain_rules πŸ”’
Whether a rule of rules matches the glyphs of ctx.

Type AliasesΒ§

MatchFn πŸ”’
Matches a glyph against a rule value: a glyph ID or a class. The rule walks are generic over it so that matching inlines; would_apply, which is cold, takes it by reference.
RuleSets πŸ”’
Offsets to rule sets, which are null for glyphs or classes without rules.