module text_scriptssource
Complex scripts for pkg::alloy::text (REFOCUS.md, R6d): the shapers HarfBuzz has for Arabic and Syriac, Hebrew, the nine Indic scripts, Khmer, Myanmar, Thai and Lao, Hangul and the 84 scripts of the Universal Shaping Engine, with their syllable machines and tables; text in either direction and both mixed by UAX #9; lines of Thai, Lao, Khmer and Myanmar broken between graphemes; and the OpenType language systems of every BCP 47 tag HarfBuzz knows. A program installs them on its fonts before laying text out:
var fonts = Fonts::create();
text_scripts::install_into(&var fonts);
ui.install_fonts(text_scripts::install_into); // or a ui's, for each fonts it lays text out with
Without them every run is shaped by the default shaper (Arabic letters unjoined, Indic clusters unordered) and laid out left to right, the same on every target.
## How it was built
**R6d as built** (2026-10-22; REFOCUS.md, question 5A): moved
out of text, whose F10b and F10c notes tell how it was built:
shaping/ the shapers (complex.alloy choosing one per run and
dispatching to it as text's ComplexShaper, kept in the plan) with
machines.alloy and language_tags.alloy, which unicode/machines.alloy
and unicode/language_tags.alloy generate from HarfBuzz 14.1.0's
headers, and languages.alloy reading BCP 47 tags; unicode/ bidi
(bidi.alloy, levels.alloy) and script_tables.alloy, the
Bidi_Class, mirrors, Indic and USE categories, vowel constraints and
Arabic presentation forms text's unicode/generate.alloy writes beside
its own tables. install_into sets text's ScriptHooks on the fonts.
Tests: tests.alloy; check.alloy against hb-shape (HarfBuzz's own
tests, the scripts' cases in Noto fonts, pointed Hebrew right to left);
unicode/conformance.alloy BidiTest.txt and BidiCharacterTest.txt.
fn install_intosource
exp fn install_into(fonts: &var Fonts)
What the fonts lay text out with from here on: the complex shapers, bidi and the language systems.
fn hookssource
exp fn hooks() -> ScriptHooks
The hooks text calls, for a plan made apart from fonts (text's
Plan::compile and shape).