text_fonts

module pkg::alloy::text::shaping::opentypesource

What GSUB and GPOS share: the script, language and feature lists that pick lookups, coverage and class tables, lookup flags and GDEF's glyph classes.

const SINGLE_SUBSTITUTIONsource

exp const SINGLE_SUBSTITUTION: u32 = 1;

GSUB's lookup types

const MULTIPLE_SUBSTITUTIONsource

exp const MULTIPLE_SUBSTITUTION: u32 = 2;

const ALTERNATE_SUBSTITUTIONsource

exp const ALTERNATE_SUBSTITUTION: u32 = 3;

const LIGATURE_SUBSTITUTIONsource

exp const LIGATURE_SUBSTITUTION: u32 = 4;

const CONTEXT_SUBSTITUTIONsource

exp const CONTEXT_SUBSTITUTION: u32 = 5;

const CHAINED_CONTEXT_SUBSTITUTIONsource

exp const CHAINED_CONTEXT_SUBSTITUTION: u32 = 6;

const REVERSE_CHAINED_SUBSTITUTIONsource

exp const REVERSE_CHAINED_SUBSTITUTION: u32 = 8;

const SINGLE_ADJUSTMENTsource

exp const SINGLE_ADJUSTMENT: u32 = 1;

GPOS's lookup types

const PAIR_ADJUSTMENTsource

exp const PAIR_ADJUSTMENT: u32 = 2;

const CURSIVE_ATTACHMENT_LOOKUPsource

exp const CURSIVE_ATTACHMENT_LOOKUP: u32 = 3;

const MARK_TO_BASEsource

exp const MARK_TO_BASE: u32 = 4;

const MARK_TO_LIGATUREsource

exp const MARK_TO_LIGATURE: u32 = 5;

const MARK_TO_MARKsource

exp const MARK_TO_MARK: u32 = 6;

const CONTEXT_POSITIONINGsource

exp const CONTEXT_POSITIONING: u32 = 7;

const CHAINED_CONTEXT_POSITIONINGsource

exp const CHAINED_CONTEXT_POSITIONING: u32 = 8;

const CONTEXT_GLYPHSsource

exp const CONTEXT_GLYPHS: u32 = 1;

contextual subtable formats: rules by glyphs, rules by classes, one rule of coverage tables

const CONTEXT_CLASSESsource

exp const CONTEXT_CLASSES: u32 = 2;

const CONTEXT_COVERAGESsource

exp const CONTEXT_COVERAGES: u32 = 3;

fn feature_tablesource

exp fn feature_table(d: &[u8], feature_list: u64, variation: Option<u64>, index: u32) -> u64

The feature table the feature's index names: its record's, or the one the feature variation in force puts in its place.

type LookupTablesource

exp type LookupTable = enum

The table a lookup is in, whose lookup types differ.

Variants

Substitution
Positioning

type Lookupsource

exp type Lookup = struct

A lookup's header: its type, the glyphs it sees and its subtables.

Fields

exp kind: u32
exp flags: u32
exp filter: u32

its mark filtering set

exp count: u64

its subtables

Functions

fn Lookup::readsource

exp fn Lookup::read(d: &[u8], at: u64) -> Lookup

fn propssource

exp fn props(self l: &Lookup) -> u32

The lookup's flags, its mark filtering set in the high half when it uses one (HarfBuzz's lookup props).

fn reversesource

exp fn reverse(self l: &Lookup, d: &[u8]) -> bool

Whether it is a reverse chained lookup, applied from the last glyph.

type Subtablesource

exp type Subtable = struct

A lookup's subtable: its type and offset in the font.

Fields

exp kind: u32
exp at: u64

fn subtablesource

exp fn subtable(self l: &Lookup, d: &[u8], k: u64, table: LookupTable) -> Subtable

The lookup's subtable, through an extension subtable to the one it holds.

fn lookup_atsource

exp fn lookup_at(d: &[u8], table: u64, index: u32) -> Option<u64>

The offset of the table's lookup in the font, if it has the lookup.

type LookupSetssource

exp type LookupSets = struct

Which glyphs each lookup of a GSUB or GPOS table may apply at, a bit a glyph: those its subtables' first coverage tables cover, every glyph for a subtable of a type not known. Shaping passes over the rest at once. After the lookups' rows, where each lookup's subtables start among the digests, then each subtable's digest: three 64-bit masks of a covered glyph's bits 0 to 5, 4 to 9 and 9 to 14 (HarfBuzz's hb_set_digest_t), which most glyphs a subtable does not cover miss.

Fields

exp words: u64

a lookup's 64-bit words

exp count: u64
exp bits: Bits

Functions

type Bitssource

exp type Bits = enum

The sets' bits: their own, or those of the face an instance of a variable face shares them with.

Variants

Owned: Vector<u64>
Shared: &[u64]

fn LookupSets::nonesource

exp fn LookupSets::none() -> LookupSets

The sets of a face without the table.

fn sharedsource

exp fn shared(self sets: &LookupSets) -> LookupSets

The same sets, reading these ones' bits, which must outlive them.

fn LookupSets::ofsource

exp fn LookupSets::of(
    d: &[u8],
    table: Option<u64>,
    glyph_count: u32,
    kind: LookupTable
) -> LookupSets

fn digestssource

exp fn digests(self sets: &LookupSets, lookup: u32, subtables: u64) -> &[u64]

The digests of the lookup's subtables, three words each; none past the face's lookups.

fn digest_hassource

exp fn digest_has(digests: &[u64], at: u64, glyph: u32) -> bool

Whether a digest (three words at at) may hold the glyph.

fn rowsource

exp fn row(self sets: &LookupSets, lookup: u32) -> &[u64]

The lookup's bits, a glyph each, none past the face's lookups.

fn has_glyphsource

exp fn has_glyph(row: &[u64], glyph: u32) -> bool

Whether the glyph's bit is set in a lookup's row.

fn may_applysource

exp fn may_apply(self sets: &LookupSets, lookup: u32, glyph: u32) -> bool

Whether the lookup may apply at the glyph.

fn coveragesource

exp fn coverage(d: &[u8], at: u64, glyph: u32) -> Option<u32>

The glyph's index in the coverage table, if it covers it.

fn class_ofsource

exp fn class_of(d: &[u8], at: u64, glyph: u32) -> u32

The glyph's class in the class definition table, 0 when unlisted or with no table (at 0).

fn find_scriptsource

exp fn find_script(d: &[u8], table: u64, tag: u32) -> Option<u64>

The offset of the table's (GSUB's or GPOS's) script record for the tag, if it has one.

fn find_languagesource

exp fn find_language(d: &[u8], script: u64, tag: u32) -> Option<u64>

The script's language system for the tag, if it has one.

fn default_languagesource

exp fn default_language(d: &[u8], script: u64) -> Option<u64>

The script's default language system, if it has one.

fn feature_tagsource

exp fn feature_tag(d: &[u8], table: u64, index: u32) -> u32

The tag of the table's feature.

fn feature_countsource

exp fn feature_count(d: &[u8], table: u64) -> u32

How many features the table lists.

fn lookup_countsource

exp fn lookup_count(d: &[u8], table: u64) -> u32

How many lookups the table has.