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.
FeatureFlagsPauseFeatureMapLookupMapStageNO_FEATUREGLOBAL_BITPlanmask_ofone_maskfeaturefeature_indexBuilderBuilder::ofadd_featureenable_featureenableadd_gsub_pauseadd_gpos_pausehas_featurePlan::compile
type FeatureFlagssource
exp type FeatureFlags = struct
How a feature is applied.
Fields
exp global: bool = falseto every glyph, through the global mask bit
exp has_fallback: bool = falsegiven a mask even when the face lacks it
exp manual_zwnj: bool = falseZWNJ not skipped when matching context
exp manual_zwj: bool = falseZWJ not skipped when matching input
exp global_search: bool = falselooked for outside the language system too
exp random: bool = falsealternates picked at random
exp per_syllable: bool = falsematching kept within a syllable
type Pausesource
exp type Pause = enum
What the shaper does between two stages of lookups.
Variants
NothingClearSubstitutionFlagsArabicStretchrecords
stch's glyphsArabicFallbackpresentation forms where the face lacks the features
IndicSyllablesIndicInitialReorderingIndicFinalReorderingKhmerSyllablesKhmerReorderingMyanmarSyllablesMyanmarReorderingUseSyllablesUseRepharecords
rphf's glyphsUsePreBaserecords
pref's glyphsUseReordering
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: u32exp index: [u32 : 2]exp stage: [u32 : 2]exp shift: u32exp mask: u32exp one_mask: u32its value 1
exp auto_zwnj: boolexp auto_zwj: boolexp random: boolexp per_syllable: boolexp needs_fallback: bool
type LookupMapsource
exp type LookupMap = struct
A lookup of the plan and the glyphs it applies to.
Fields
exp index: u32exp mask: u32exp auto_zwnj: bool = trueexp auto_zwj: bool = trueexp random: bool = falseexp per_syllable: bool = falseexp feature: u32 = 0
type Stagesource
exp type Stage = struct
A stage: the lookups before end, then the pause.
Fields
exp end: u64exp 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: u32its key
exp script: Scriptexp language: Stringexp rtl: boolexp settings: Vector<Feature>exp shaper: Shaperwhat it is
exp chosen: [u32 : 2]the script tags chosen in GSUB and GPOS
exp found: [bool : 2]exp global_mask: u32 = GLOBAL_BITexp 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 = 0exp frac_mask: u32 = 0exp numr_mask: u32 = 0exp dnom_mask: u32 = 0exp has_frac: bool = falseexp kern_mask: u32 = 0exp apply_gpos: bool = falseexp apply_kern: bool = falseexp zero_marks: bool = falseexp has_gpos_mark: bool = falseexp adjust_mark_positioning: bool = falsewhen zeroing marks' advances
exp fallback_mark_positioning: bool = falseexp fallback_glyph_classes: bool = falseexp complex: Option<*var ComplexShaper> = ::Nonea 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
exp fn mask_of(self plan: &Plan, feature: u32) -> u32exp fn one_mask(self plan: &Plan, feature: u32) -> u32exp fn feature(self plan: &Plan, feature: u32) -> Option<&FeatureMap>exp fn feature_index(self plan: &Plan, table: u64, feature: u32) -> u32exp fn Plan::compile( face_index: u32, face: &Face, script: Script, language: &[u8], rtl: bool, settings: &[Feature], scripts: &Option<ScriptHooks> ) -> Plan
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: &Faceexp script: Scriptexp rtl: boolexp shaper: Shaperexp chosen: [u32 : 2] = [0, 0]exp found: [bool : 2] = [false, false]
Functions
exp fn Builder::of( face: &Face, script: Script, language: &[u8], rtl: bool, scripts: &Option<ScriptHooks> ) -> Builderexp fn add_feature(self b: &var Builder, tag: u32, flags: FeatureFlags, value: u32)exp fn enable_feature(self b: &var Builder, tag: u32, flags: FeatureFlags)exp fn enable(self b: &var Builder, name: &[u8])exp fn add_gsub_pause(self b: &var Builder, pause: Pause)exp fn add_gpos_pause(self b: &var Builder, pause: Pause)exp fn has_feature(self b: &Builder, tag: u32) -> bool
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.