AUDIO
Source snapshot · 11 November 2026

Portable layout, SVG drawing and animation

Optional local-font run shaping

Enable ravet-surface/text (or ravet/text) for surface::text. TextFont copies caller-supplied local font bytes, at most 16 MiB, selecting a backend face index and its default variation instance; explicit with_variations selects an immutable instance from checked source fvar axes. No system font discovery, global font registration, file/network loading or fallback is implicit. Font parsing/cache work belongs on UI/worker threads and is not complete corruption validation.

shape accepts one independent complete horizontal run, at most 4096 UTF8 bytes, with finite size (0,1024], explicit left/right direction, optional script/language and at most 32 global printable-tag feature overrides. Default font features apply unless overridden. Script may be guessed; language tags are restricted to 1..63 ASCII alphanumeric/hyphen bytes, without full BCP47 validation. Controls, newlines and Unicode noncharacters reject; spaces, combining marks and joiners are retained. The caller segments scripts/bidi text before shaping; partial-run surrounding context, paragraph bidi resolution, wrapping and fallback are not supplied by this independent-run API.

Returned glyphs are in visual order with font-specific IDs, UTF8 byte clusters, scaled positions/advances and upward Y. Glyph zero reports missing coverage. The run retains total pen advance, rather than ink bounds; caller keeps matching font/text identity and applies its rendering/baseline transform. Returned glyphs cap at 16384 after shaping. Backend transient memory/time is not globally bounded by that output cap. Font loading/shaping allocate; cache runs before callbacks. Shaping itself does not select a presenter. The separate CPU raster feature can render explicitly prepared local-font outlines; native/GPU/accessibility integration and callback deadlines require separate evidence.

The default build excludes the shaper dependency. Optional HarfRust 0.14.0 (MIT), read-fonts/font-types and their locked transitive notices remain separate from RAVET's licence; see licensing. A public unmodified Noto Sans Arabic fixture retains OFL/provenance. Portable groups exercise contextual Arabic/marks/clusters/scaling, actual kerning override, repeat/empty/missing coverage and invalid/capacity/face rejection. Eight actual runs match installed HarfBuzz 14.4.0 numeric glyphs, UTF8 clusters, positions and advances, including explicit kerning disable.

CARGO_BUILD_JOBS=2 cargo test -p ravet-surface --features text --locked
CARGO_BUILD_JOBS=2 cargo run -p ravet-surface --features text \
  --example shape-text --locked -- /path/to/local.ttf 'سلام' rtl
# Optional independent installed CLI (not needed by workspace tests):
python3 scripts/check-text-shaping.py --hb-shape /path/to/hb-shape

This is the tested local-font/single-run profile, not every script/font/paragraph or render backend. See decision 0092.

Optional explicit local font fallback supplies an ordered caller-owned stack, whole-grapheme contextual selection, source/matching-face ownership and complete SVG/CPU consumption. It does not change the independent single-font APIs or infer system/script/paragraph policy.