text_fonts

module pkg::alloy::text::shaping::shapersource

Shaping a run of text in one face, in one direction, as HarfBuzz's OpenType shaper does (hb-ot-shape.cc): characters given their Unicode props and grapheme clusters, prepared by their script's shaper, mirrored right to left, normalized and mapped to glyphs, then substituted and positioned by the plan's lookups in stages, default ignorables hidden at the end.

type Shapedsource

exp type Shaped = struct

A run's glyphs, in font units, each with the byte offset of the first character it shows, in the text's order (right to left too: HarfBuzz gives the same glyphs reversed).

Fields

exp infos: Vector<GlyphInfo>
exp positions: Vector<GlyphPosition>

fn shapesource

exp fn shape(
    face: &Face,
    text: &[u8],
    start: u64,
    end: u64,
    settings: &[Feature],
    rtl: bool,
    scripts: &Option<ScriptHooks>
) -> Shaped

Shapes the run as hb-shape does without a script or language: the script its first character of one names, the default language, the direction given, the complex shapers text_scripts gives.

fn guess_scriptsource

exp fn guess_script(text: &[u8], start: u64, end: u64) -> Script

The script of the first character with one of its own, Common without.

fn shape_withsource

exp fn shape_with(face: &Face, plan: &Plan, text: &[u8], start: u64, end: u64) -> Shaped

Shapes text[start..end] in the face by the plan.