text

module shaping::plansource

What shaping a run applies, compiled once for a face, script, language, direction and set of features (HarfBuzz's shape plan and feature map, hb-ot-map.cc and hb-ot-shape.cc): the script's shaper, the language system its features are read from, each feature's mask, and the lookups of GSUB and GPOS in stages, each stage ending in what the shaper does between them.

type FeatureFlagssource

exp type FeatureFlags = struct

How a feature is applied.

Fields

exp global: bool = false

to every glyph, through the global mask bit

exp has_fallback: bool = false

given a mask even when the face lacks it

exp manual_zwnj: bool = false

ZWNJ not skipped when matching context

exp manual_zwj: bool = false

ZWJ not skipped when matching input

looked for outside the language system too

exp random: bool = false

alternates picked at random

exp per_syllable: bool = false

matching kept within a syllable

type Pausesource

exp type Pause = enum

What the shaper does between two stages of lookups.

Variants

Nothing
ClearSubstitutionFlags
ArabicStretch

records stch's glyphs

ArabicFallback

presentation forms where the face lacks the features

IndicSyllables
IndicInitialReordering
IndicFinalReordering
KhmerSyllables
KhmerReordering
MyanmarSyllables
MyanmarReordering
UseSyllables
UseRepha

records rphf's glyphs

UsePreBase

records pref's glyphs

UseReordering

type FeatureMapsource

exp type FeatureMap = struct

A feature of the plan: where its lookups are in each table (0xFFFF for none), its stage in each, and its bits in a glyph's mask.

Fields

exp tag: u32
exp index: [u32 : 2]
exp stage: [u32 : 2]
exp shift: u32
exp mask: u32
exp one_mask: u32

its value 1

exp auto_zwnj: bool
exp auto_zwj: bool
exp random: bool
exp per_syllable: bool
exp needs_fallback: bool

type LookupMapsource

exp type LookupMap = struct

A lookup of the plan and the glyphs it applies to.

Fields

exp index: u32
exp mask: u32
exp auto_zwnj: bool = true
exp auto_zwj: bool = true
exp random: bool = false
exp per_syllable: bool = false
exp feature: u32 = 0

type Stagesource

exp type Stage = struct

A stage: the lookups before end, then the pause.

Fields

exp end: u64
exp pause: Pause

const NO_FEATUREsource

exp const NO_FEATURE: u32 = 0xFFFF;

const GLOBAL_BITsource

exp const GLOBAL_BIT: u32 = 0x80000000;

type Plansource

exp type Plan = struct

Fields

exp face: u32

its key

exp script: Script
exp language: String
exp rtl: bool
exp settings: Vector<Feature>
exp shaper: Shaper

what it is

exp chosen: [u32 : 2]

the script tags chosen in GSUB and GPOS

exp found: [bool : 2]
exp global_mask: u32 = GLOBAL_BIT
exp features: Vector<FeatureMap>
exp substitutions: Vector<LookupMap>
exp positionings: Vector<LookupMap>
exp substitution_stages: Vector<Stage>
exp positioning_stages: Vector<Stage>
exp rtlm_mask: u32 = 0
exp frac_mask: u32 = 0
exp numr_mask: u32 = 0
exp dnom_mask: u32 = 0
exp has_frac: bool = false
exp kern_mask: u32 = 0
exp apply_gpos: bool = false
exp apply_kern: bool = false
exp zero_marks: bool = false
exp has_gpos_mark: bool = false
exp adjust_mark_positioning: bool = false

when zeroing marks' advances

exp fallback_mark_positioning: bool = false
exp fallback_glyph_classes: bool = false
exp complex: Option<*var ComplexShaper> = ::None

a complex script's shaper (pkg::alloy::text_scripts), none for the default one, and the characters' mirrors right to left

exp mirror: Option<(u32) -> Option<u32>> = ::None

Functions

fn mask_ofsource

exp fn mask_of(self plan: &Plan, feature: u32) -> u32

A feature's mask, 0 when the plan has not got it.

fn one_masksource

exp fn one_mask(self plan: &Plan, feature: u32) -> u32

The mask setting the feature to 1, 0 when the plan has not got it.

fn featuresource

exp fn feature(self plan: &Plan, feature: u32) -> Option<&FeatureMap>

fn feature_indexsource

exp fn feature_index(self plan: &Plan, table: u64, feature: u32) -> u32

Whether the plan's language system has the feature in a table.

type Buildersource

exp type Builder = struct

What a plan is being built from: the language systems found, the features asked for and the stages so far.

Fields

exp face: &Face
exp script: Script
exp rtl: bool
exp shaper: Shaper
exp chosen: [u32 : 2] = [0, 0]
exp found: [bool : 2] = [false, false]

Functions

fn Builder::ofsource

exp fn Builder::of(
    face: &Face,
    script: Script,
    language: &[u8],
    rtl: bool,
    scripts: &Option<ScriptHooks>
) -> Builder

fn add_featuresource

exp fn add_feature(self b: &var Builder, tag: u32, flags: FeatureFlags, value: u32)

fn enable_featuresource

exp fn enable_feature(self b: &var Builder, tag: u32, flags: FeatureFlags)

Adds the feature, on for every glyph.

fn enablesource

exp fn enable(self b: &var Builder, name: &[u8])

fn add_gsub_pausesource

exp fn add_gsub_pause(self b: &var Builder, pause: Pause)

Ends the GSUB stage with the pause.

fn add_gpos_pausesource

exp fn add_gpos_pause(self b: &var Builder, pause: Pause)

fn has_featuresource

exp fn has_feature(self b: &Builder, tag: u32) -> bool

Whether either table's language system has the feature.

fn Plan::compilesource

exp fn Plan::compile(
    face_index: u32,
    face: &Face,
    script: Script,
    language: &[u8],
    rtl: bool,
    settings: &[Feature],
    scripts: &Option<ScriptHooks>
) -> Plan

The plan for the run, its features those HarfBuzz turns on with the shaper's and the settings', its shaper a complex one where text_scripts gives one.