module shaping::buffersource
The glyphs being shaped, as HarfBuzz's buffer keeps them: each with its cluster, the features it takes (a mask), what Unicode says of its character, what GDEF and substitutions say of its glyph, the ligature it belongs to, its syllable and what its script's shaper found; and their positions, with what each is attached to. Glyphs stay in the text's order, right to left too.
BASE_GLYPHLIGATUREMARKSUBSTITUTEDLIGATEDMULTIPLIEDPRESERVEDGlyphInfoGlyphPositionMARK_ATTACHMENTCURSIVE_ATTACHMENTset_unicodeis_default_ignorablegeneralset_generalis_unicode_markcombining_classset_combining_classis_unicode_spaceis_formatspace_kindset_space_kindis_variation_selectorset_variation_selectoris_default_ignorableset_default_ignorableclear_default_ignorableis_hiddenunhideis_continuationset_continuationclear_continuationis_zwjis_zwnjis_base_glyphis_ligatureis_marksubstitutedligatedmultipliedclear_ligated_and_multipliedclear_substitutedset_ligature_propsset_mark_propsset_componentligature_idligature_componentcomponent_countBuffercontext_beforecontext_afterlengthnext_ligature_idmerge_clustersmerge_clusters_ofsortdelete_glyphsyllable_endcluster_endreverse_rangemodified_combining_class
const BASE_GLYPHsource
exp const BASE_GLYPH: u16 = 0x02;
What GDEF and substitutions say of a glyph (HarfBuzz's glyph props): its class, then whether a substitution changed it, ligated it or multiplied it; a mark's attachment class in the high byte.
const LIGATUREsource
exp const LIGATURE: u16 = 0x04;
const MARKsource
exp const MARK: u16 = 0x08;
const SUBSTITUTEDsource
exp const SUBSTITUTED: u16 = 0x10;
const LIGATEDsource
exp const LIGATED: u16 = 0x20;
const MULTIPLIEDsource
exp const MULTIPLIED: u16 = 0x40;
const PRESERVEDsource
exp const PRESERVED: u16 = SUBSTITUTED | LIGATED | MULTIPLIED;
type GlyphInfosource
exp type GlyphInfo = struct
A glyph being shaped and where its text started.
Fields
exp glyph: u32the character until glyphs are mapped, then the glyph
exp cluster: u32the byte offset in the run's text where its cluster starts
exp mask: u32 = 0the features applying to it
exp mapped: u32 = 0the glyph normalization found for the character
exp unicode: u16 = 0exp props: u16 = 0exp ligature: u8 = 0exp syllable: u8 = 0its syllable's serial in the high four bits, its kind below
exp category: u8 = 0its script's shaper's
exp position: u8 = 0its script's shaper's
Functions
exp fn set_unicode(self info: &var GlyphInfo, buffer: &var Buffer)exp fn general( self info: &GlyphInfo ) -> GeneralCategoryexp fn set_general(self info: &var GlyphInfo, category: GeneralCategory)exp fn is_unicode_mark( self info: &GlyphInfo ) -> boolexp fn combining_class(self info: &GlyphInfo) -> u32exp fn set_combining_class(self info: &var GlyphInfo, class: u32)exp fn is_unicode_space(self info: &GlyphInfo) -> boolexp fn is_format(self info: &GlyphInfo) -> boolexp fn space_kind(self info: &GlyphInfo) -> u32exp fn set_space_kind(self info: &var GlyphInfo, kind: u32)exp fn is_variation_selector(self info: &GlyphInfo) -> boolexp fn set_variation_selector(self info: &var GlyphInfo, customized: bool)exp fn is_default_ignorable( self info: &GlyphInfo ) -> boolexp fn set_default_ignorable(self info: &var GlyphInfo)exp fn clear_default_ignorable(self info: &var GlyphInfo)exp fn is_hidden(self info: &GlyphInfo) -> boolexp fn unhide(self info: &var GlyphInfo)exp fn is_continuation(self info: &GlyphInfo) -> boolexp fn set_continuation(self info: &var GlyphInfo)exp fn clear_continuation(self info: &var GlyphInfo)exp fn is_zwj(self info: &GlyphInfo) -> boolexp fn is_zwnj(self info: &GlyphInfo) -> boolexp fn is_base_glyph(self info: &GlyphInfo) -> boolexp fn is_ligature(self info: &GlyphInfo) -> boolexp fn is_mark(self info: &GlyphInfo) -> boolexp fn substituted(self info: &GlyphInfo) -> boolexp fn ligated(self info: &GlyphInfo) -> boolexp fn multiplied(self info: &GlyphInfo) -> boolexp fn clear_ligated_and_multiplied(self info: &var GlyphInfo)exp fn clear_substituted(self info: &var GlyphInfo)exp fn set_ligature_props(self info: &var GlyphInfo, id: u32, components: u32)exp fn set_mark_props(self info: &var GlyphInfo, id: u32, component: u32)exp fn set_component(self info: &var GlyphInfo, component: u32)exp fn ligature_id(self info: &GlyphInfo) -> u32exp fn ligature_component(self info: &GlyphInfo) -> u32exp fn component_count(self info: &GlyphInfo) -> u32
type GlyphPositionsource
exp type GlyphPosition = struct
A glyph's position, in font units: the advance moves the pen, the
offset moves the glyph only; what it attaches to is chain glyphs
away, by attach (MARK_ATTACHMENT, CURSIVE_ATTACHMENT).
Fields
exp x_advance: f32 = 0.0exp y_advance: f32 = 0.0exp x_offset: f32 = 0.0exp y_offset: f32 = 0.0exp chain: i32 = 0exp attach: u8 = 0
const MARK_ATTACHMENTsource
exp const MARK_ATTACHMENT: u8 = 1;
const CURSIVE_ATTACHMENTsource
exp const CURSIVE_ATTACHMENT: u8 = 2;
fn set_unicodesource
exp fn set_unicode(self info: &var GlyphInfo, buffer: &var Buffer)
The character's Unicode props, set on the glyph.
fn is_default_ignorablesource
exp fn is_default_ignorable(c: u32) -> bool
HarfBuzz's Default_Ignorable_Code_Point, which leaves out the Hangul fillers and others shown as glyphs.
fn generalsource
exp fn general(
self info: &GlyphInfo
) -> GeneralCategory
fn set_generalsource
exp fn set_general(self info: &var GlyphInfo, category: GeneralCategory)
fn is_unicode_marksource
exp fn is_unicode_mark(
self info: &GlyphInfo
) -> bool
fn combining_classsource
exp fn combining_class(self info: &GlyphInfo) -> u32
The mark's modified combining class, 0 for other characters.
fn set_combining_classsource
exp fn set_combining_class(self info: &var GlyphInfo, class: u32)
fn is_unicode_spacesource
exp fn is_unicode_space(self info: &GlyphInfo) -> bool
fn is_formatsource
exp fn is_format(self info: &GlyphInfo) -> bool
fn space_kindsource
exp fn space_kind(self info: &GlyphInfo) -> u32
The space's width when the face lacks its glyph (SPACE_*), 0 for none.
fn set_space_kindsource
exp fn set_space_kind(self info: &var GlyphInfo, kind: u32)
fn is_variation_selectorsource
exp fn is_variation_selector(self info: &GlyphInfo) -> bool
fn set_variation_selectorsource
exp fn set_variation_selector(self info: &var GlyphInfo, customized: bool)
Marks a variation selector the face has no sequence for as Format, so that GSUB sees it, or gives it its own category back.
fn is_default_ignorablesource
exp fn is_default_ignorable(
self info: &GlyphInfo
) -> bool
A default ignorable no substitution has changed.
fn set_default_ignorablesource
exp fn set_default_ignorable(self info: &var GlyphInfo)
fn clear_default_ignorablesource
exp fn clear_default_ignorable(self info: &var GlyphInfo)
fn unhidesource
exp fn unhide(self info: &var GlyphInfo)
fn is_continuationsource
exp fn is_continuation(self info: &GlyphInfo) -> bool
fn set_continuationsource
exp fn set_continuation(self info: &var GlyphInfo)
fn clear_continuationsource
exp fn clear_continuation(self info: &var GlyphInfo)
fn is_zwjsource
exp fn is_zwj(self info: &GlyphInfo) -> bool
fn is_zwnjsource
exp fn is_zwnj(self info: &GlyphInfo) -> bool
fn is_base_glyphsource
exp fn is_base_glyph(self info: &GlyphInfo) -> bool
fn is_ligaturesource
exp fn is_ligature(self info: &GlyphInfo) -> bool
fn is_marksource
exp fn is_mark(self info: &GlyphInfo) -> bool
fn substitutedsource
exp fn substituted(self info: &GlyphInfo) -> bool
fn ligatedsource
exp fn ligated(self info: &GlyphInfo) -> bool
fn multipliedsource
exp fn multiplied(self info: &GlyphInfo) -> bool
fn clear_ligated_and_multipliedsource
exp fn clear_ligated_and_multiplied(self info: &var GlyphInfo)
fn clear_substitutedsource
exp fn clear_substituted(self info: &var GlyphInfo)
fn set_ligature_propssource
exp fn set_ligature_props(self info: &var GlyphInfo, id: u32, components: u32)
fn set_mark_propssource
exp fn set_mark_props(self info: &var GlyphInfo, id: u32, component: u32)
fn set_componentsource
exp fn set_component(self info: &var GlyphInfo, component: u32)
fn ligature_idsource
exp fn ligature_id(self info: &GlyphInfo) -> u32
fn ligature_componentsource
exp fn ligature_component(self info: &GlyphInfo) -> u32
Which component of its ligature a mark is on, 0 for a ligature itself.
fn component_countsource
exp fn component_count(self info: &GlyphInfo) -> u32
The components a ligature was made of, 1 for any other glyph.
type Buffersource
exp type Buffer = struct
The buffer of a run being shaped.
Fields
exp infos: Vector<GlyphInfo>exp positions: Vector<GlyphPosition> = Vector<GlyphPosition>::empty()exp rtl: bool = falseexp script: Script = Script::Unknownexp has_ignorables: bool = falsewhat the run holds, found as it is shaped
exp has_continuations: bool = falseexp has_grapheme_joiner: bool = falseexp has_fraction_slash: bool = falseexp has_space_fallback: bool = falseexp has_broken_syllable: bool = falseexp has_attachments: bool = falseexp has_variation_selector_fallback: bool = falseexp has_stretch: bool = falseexp before: [u32 : 5] = [0, 0, 0, 0, 0]up to five characters of the text on either side of the run, the nearest first
exp before_count: u64 = 0exp after: [u32 : 5] = [0, 0, 0, 0, 0]exp after_count: u64 = 0
Functions
exp fn context_before(self buffer: &Buffer) -> &[u32]exp fn context_after(self buffer: &Buffer) -> &[u32]exp fn length(self buffer: &Buffer) -> u64exp fn next_ligature_id(self buffer: &var Buffer) -> u32exp fn merge_clusters(self buffer: &var Buffer, first: u64, last: u64)exp fn sort( self buffer: &var Buffer, start: u64, end: u64, before: |&| (&GlyphInfo, &GlyphInfo) -> bool )exp fn delete_glyph(self buffer: &var Buffer, at: u64)exp fn syllable_end(self buffer: &Buffer, start: u64) -> u64exp fn cluster_end(self buffer: &Buffer, start: u64) -> u64exp fn reverse_range(self buffer: &var Buffer, start: u64, end: u64)
fn context_beforesource
exp fn context_before(self buffer: &Buffer) -> &[u32]
fn context_aftersource
exp fn context_after(self buffer: &Buffer) -> &[u32]
fn lengthsource
exp fn length(self buffer: &Buffer) -> u64
fn next_ligature_idsource
exp fn next_ligature_id(self buffer: &var Buffer) -> u32
A new ligature id, from 1 to 7 in turn.
fn merge_clusterssource
exp fn merge_clusters(self buffer: &var Buffer, first: u64, last: u64)
Gives the glyphs from start to end one cluster, the least of theirs, with the glyphs before and after sharing their first and last ones'.
fn merge_clusters_ofsource
exp fn merge_clusters_of(infos: &var [GlyphInfo], first: u64, last: u64)
Gives infos[first..last] one cluster, as merge_clusters does.
fn sortsource
exp fn sort(
self buffer: &var Buffer,
start: u64,
end: u64,
before: |&| (&GlyphInfo, &GlyphInfo) -> bool
)
Sorts the glyphs from start to end by before, stably, merging the
clusters of those it moves (HarfBuzz's buffer sort, an insertion sort).
fn delete_glyphsource
exp fn delete_glyph(self buffer: &var Buffer, at: u64)
Removes the glyph, giving its cluster to a neighbor when no glyph of it
is left (HarfBuzz's delete_glyph, with the glyphs before at its out
buffer).
fn syllable_endsource
exp fn syllable_end(self buffer: &Buffer, start: u64) -> u64
The end of the syllable starting at start.
fn cluster_endsource
exp fn cluster_end(self buffer: &Buffer, start: u64) -> u64
The end of the cluster starting at start.
fn reverse_rangesource
exp fn reverse_range(self buffer: &var Buffer, start: u64, end: u64)
Reverses the glyphs from start to end, and their positions when there are some.
fn modified_combining_classsource
exp fn modified_combining_class(c: u32) -> u32
The character's canonical combining class as HarfBuzz orders marks by it: Hebrew's points in the order fonts expect (SBL Hebrew's: shin and sin dots, dagesh and rafe before the vowels), Arabic's shadda before the other harakat, and a few marks of Telugu, Thai, Lao and Tibetan.