ui_app

module pkg::alloy::text::shaping::applysource

Applying GSUB's and GPOS's lookups to a buffer, as HarfBuzz's apply context does (hb-ot-layout-gsubgpos.hh): each lookup over the glyphs its feature's mask selects, skipping those its flags ignore and the default ignorables; sequences matched by glyph, class or coverage, ligatures formed with the marks between their components kept apart, and the lookups a contextual rule names applied at positions within its match. The buffer is one array: the glyphs before at are those already done, HarfBuzz's output buffer, the rest its input.

type Applysource

exp type Apply = struct

The state of applying a lookup.

Fields

exp face: &Face
exp data: &[u8]

where the lookups are: the face's, or Arabic's fallback

exp digests: bool = true

whether the face's subtable digests apply

exp table: LookupTable
exp at: u64

the glyph being looked at

exp lookup_index: u32 = 0
exp lookup_mask: u32 = 1
exp lookup_props: u32 = 0
exp auto_zwnj: bool = true
exp auto_zwj: bool = true
exp per_syllable: bool = false
exp random: bool = false
exp random_state: u32 = 1
exp nesting_left: u32 = MAX_NESTING
exp rtl: bool = false
exp has_glyph_classes: bool = false
exp last_base: Option<u64> = ::None

mark-to-base and mark-to-ligature's last base found, and up to where it was looked for

exp last_base_until: u64 = 0
exp positions: Vector<u64> = Vector<u64>::empty()

where the glyphs of the latest match are

Functions

const MAX_NESTINGsource

exp const MAX_NESTING: u32 = 64;

const MAX_CONTEXTsource

exp const MAX_CONTEXT: u64 = 64;

the longest sequence a rule may match

const RIGHT_TO_LEFTsource

exp const RIGHT_TO_LEFT: u32 = 0x1;

lookup flags

const IGNORE_FLAGSsource

exp const IGNORE_FLAGS: u32 = 0x0E;

const IGNORE_MARKSsource

exp const IGNORE_MARKS: u32 = 0x8;

const MARK_FILTERINGsource

exp const MARK_FILTERING: u32 = 0x10;

const MARK_ATTACHMENT_TYPEsource

exp const MARK_ATTACHMENT_TYPE: u32 = 0xFF00;

fn Apply::ofsource

exp fn Apply::of(face: &Face, table: LookupTable) -> Apply

fn seessource

exp fn sees(self c: &Apply, info: &GlyphInfo, lookup_props: u32) -> bool

Whether the lookup's flags (lookup_props, its mark filtering set in the high half) let it see the glyph.

fn glyph_propssource

exp fn glyph_props(face: &Face, glyph: u32) -> u16

The glyph's props from GDEF: its class, and a mark's attachment class in the high byte.

fn set_glyphsource

exp fn set_glyph(
    self c: &Apply,
    buffer: &var Buffer,
    at: u64,
    glyph: u32,
    class_guess: u16,
    ligature: bool,
    component: bool
)

Sets the glyph at at to glyph with its props, keeping what substitutions said and adding that one did (HarfBuzz's _set_glyph_class): a ligature's or a multiplied glyph's class guessed where GDEF gives none.

fn replace_glyphsource

exp fn replace_glyph(self c: &var Apply, buffer: &var Buffer, glyph: u32)

Replaces the current glyph, moving on past it.

type Namingsource

exp type Naming = enum

How a sequence's items name glyphs: by id, by class in a class definition table, or by coverage tables at offsets from the subtable.

Variants

Glyphs
Classes: u64

the class definition table, 0 for none

Coverages: u64

the subtable

type Itemssource

exp type Items = struct

A list of items in a rule: count 16-bit values at at, none for a matcher that matches any glyph.

Fields

exp naming: Naming
exp at: u64
exp count: u64

Functions

fn Items::nonesource

exp fn Items::none() -> Items

fn matchessource

exp fn matches(self items: &Items, d: &[u8], k: u64, glyph: u32) -> bool

type Matchersource

exp type Matcher = struct

What a skipping iterator matches with (HarfBuzz's matcher_t).

Fields

exp lookup_props: u32
exp mask: u32
exp ignore_zwnj: bool
exp ignore_zwj: bool
exp ignore_hidden: bool
exp per_syllable: bool
exp syllable: u8 = 0

Functions

fn matchersource

exp fn matcher(self c: &Apply, context: bool) -> Matcher

The matcher for the input (context false) or the context around it.

type Seensource

exp type Seen = enum

What a glyph is to a matcher.

Variants

Match
NotMatch
Skip

fn seesource

exp fn see(self m: &Matcher, c: &Apply, info: &GlyphInfo, matched: Option<bool>) -> Seen

Whether the matcher matches, does not match or skips the glyph, matched what the item to match says of it (None for any glyph).

fn next_matchsource

exp fn next_match(
    self m: &Matcher,
    c: &Apply,
    infos: &[GlyphInfo],
    from: u64,
    end: u64,
    items: &Items,
    k: u64
) -> Option<u64>

The next glyph after from (before end) the matcher matches, the item's kth value naming it; None at one it does not or at the end.

fn previous_matchsource

exp fn previous_match(
    self m: &Matcher,
    c: &Apply,
    infos: &[GlyphInfo],
    from: u64,
    items: &Items,
    k: u64
) -> Option<u64>

The glyph before from the matcher matches, as next_match.

fn match_inputsource

exp fn match_input(self c: &var Apply, buffer: &Buffer, input: &Items) -> Option<[u64 : 2]>

Matches the input after the current glyph (the input's first, already matched), putting its glyphs' positions in c.positions; the end of the match and the components the glyphs make, for a ligature, when it matches (HarfBuzz's match_input).

fn ligatesource

exp fn ligate(self c: &var Apply, buffer: &var Buffer, end: u64, glyph: u32, total: u64)

Replaces the matched glyphs (c.positions, ending before end) by the ligature glyph, the marks between them taking its id and the component they were on (HarfBuzz's ligate_input).

fn match_backtracksource

exp fn match_backtrack(self c: &Apply, buffer: &Buffer, backtrack: &Items) -> bool

Matches the backtrack before the current glyph.

fn match_lookaheadsource

exp fn match_lookahead(self c: &Apply, buffer: &Buffer, lookahead: &Items, start: u64) -> bool

Matches the lookahead from start (past the input).

fn apply_recordssource

exp fn apply_records(
    self c: &var Apply,
    buffer: &var Buffer,
    records: u64,
    record_count: u64,
    match_end: u64,
    apply: (&var Apply, &var Buffer, u32) -> bool
)

The lookups a matched rule names, each at its position in the match, later positions moved as each adds or takes glyphs; then on past the match (HarfBuzz's apply_lookup). apply applies a lookup at c.at.