Separate bidi and shaping boundaries¶
Full-original BidiInfo resolves the explicitly based Unicode 16 paragraph levels.
Each measured line receives original-scalar UAX #9 L1 adjustment. RAVET then
applies an explicit atomic-grapheme rendering policy: the final non-X9-removed
scalar's post-L1 level represents the whole grapheme, while an all-X9 grapheme
uses its own post-L1 level. L2 reorders these complete units. This prevents
trailing BN joiners/tags and Prepend characters from splitting a grapheme.
It is RAVET's rendering refinement, not a claim of scalar-exact UAX #9 L2
conformance. Original bidi classes/levels/source and shaping context stay intact.
U+2028 ends a line without inventing a bidi paragraph reset; U+2029 is a paragraph
separator. Embeddings/isolates survive applicable soft wraps and U+2028. The
caller script pieces and selected font units traverse visual run order; RTL
reverses units while retaining logical characters and byte ranges.
Shaping context is the complete original content between admitted hard
separators. It excludes separator bytes, and supplies the existing backend's
nearest five surrounding codepoints for each item. Soft wrap, font, script and
bidi item boundaries do not become artificial BOT/EOT boundaries. Each run
exposes context_range() and original range(), plus absolute original-byte
source_cluster(glyph_index). A default-ignorable source unit may have no glyph;
a glyph cluster is neither a caret nor an editing selection boundary. Existing
single-font caret/edit caches do not accept this distinct layout automatically.
Each complete grapheme selects the first supplied face whose actual contextual shape contains no glyph zero. Adjacent same-face units in a homogeneous script/direction merge and shape together, preserving same-face ligatures and kerning. Unresolved units use primary replacements and explicit sorted source missing ranges. Unexpected final glyph zero for previously covered source rejects the whole layout. Glyph-zero absence does not prove emoji/variation-selector presentation conformance; cross-font ligatures are not promised.