Ordinary standalone workspace¶
The paragraph_workspace example shares one pure Rust model between export and
the macOS window. It loads exact available Arial Regular through the native
catalogue, then caller-owned explicit local alternatives and the public Noto
Arabic fixture. An unavailable/unsupported exact native selection fails without
silently choosing another face. System bytes remain memory-only. Authored export
uses the existing tiny rectangular fixtures instead, for reproducible source,
geometry and pixel evidence.
Labelled native HTML controls select nine samples, width 80..640, size 14/20/28,
base direction, alignment and SVG/pixel mode. Samples cover mixed scripts,
Arabic marks, isolates, accents/ligatures, missing characters, empty input,
hard separators, an unbreakable word and a deliberately oversized document.
Rust prepares the entire source/layout/geometry/image/JSON transition before
committing state. Commands have exact known single-key plus current u32 revision
and at most 128 bytes; stale/malformed/out-of-range commands are ignored. During
pending frontend acknowledgment controls are disabled and edits are refused.
The separate Refresh current view button remains usable for explicit recovery
from ignored stale commands or rejected image publication. The exact bounded
{"refresh":1} request reads the actual model revision without a stale client
revision and increments a distinct u32 delivery counter. It republishes the
current source/options/image without modifying the state revision. Equal-revision
updates are admitted only while an explicit refresh is pending and their delivery
counter is newer; all image, geometry and pixel-hash checks still apply. Invalid
publication releases busy ownership, retains the prior image and shows a visible
recovery diagnostic. Stale/replayed deliveries cannot overwrite it. Delivery
exhaustion refuses refresh visibly; reopening creates a new bounded model. No
response timeout or automatic retry is assumed.
Noops preserve the revision; exhaustion refuses a new transition. Layout/render
or snapshot-envelope capacity failure publishes a diagnostic revision while retaining the previously accepted
source/options/image. Programmatic native resize uses measured content width
minus 40, floored/clamped 80..640; widths below 120 or invalid dimensions preserve
the prior image. Changes only reflow when measured dimensions change.
The consumer caps images at 704×384, encoded output 45000 bytes/base64 payload 60000,
and full snapshot 65536 bytes. PNG is only bounded image transport, using the
existing optional image feature. Opaque-white CPU preparation makes the PNG
straight-byte conversion exact; browser canvas pixels must match the Rust pixel
hash before publication. SVG transport supplies explicit intrinsic width/height
in addition to the generated viewBox; browser font matching is never used for
the rendered image. Readable original source supplies the image label.
The standard title-bar Audio/MIDI settings popup remains enabled. This visual model advertises no devices and opens none. Owned native fixtures validate measured resize, focused control retention, settings composition and child-before- parent cleanup. The normal snapshot path observes actual image publication; the settings wrapper invokes updates without forwarding their Promise. The separate authored-state fixture captures the consumer's async update before that wrapper solely to await its full image publication. Browser data is prerecorded Rust output, not a dynamic Rust runtime or an independent layout oracle.
cargo test -p ravet-surface --features text,raster --test fallback_paragraph --locked
cargo test -p ravet-examples --bin paragraph_workspace --no-default-features \
--features paragraph-workspace --locked
# Native macOS consumer, default live-ui and settings popup:
cargo run -p ravet-examples --bin paragraph_workspace --features paragraph-workspace --locked
# Portable preparation without a window:
cargo run -p ravet-examples --bin paragraph_workspace --no-default-features \
--features paragraph-workspace --locked -- --export > target/paragraph-models.json
python3 scripts/check-fallback-paragraphs.py