class

CArcBidi

The Unicode Bidirectional Algorithm (UAX #9) over one paragraph of codepoints: explicit embeddings, overrides and isolates (X1-X10), weak and neutral resolution including bracket pairs (W1-W7, N0-N2), implicit levels (I1-I2), the paragraph half of L1, and line reordering (L2). HarfBuzz shapes a run in a direction it is given; this is what decides the direction and the run boundaries, which Arc used to hard-wire to LTR.

Module
Arc
Header
#include "Arc/Text/CArcBidi.h"
Namespace
Arcf

Written in-tree rather than vendored: the property data is a compact range table of the classes that matter for layout (every RTL script block, the numerals, the separators and terminators, the explicit formatting characters, the marks of the scripts that sit beside RTL text), with unlisted codepoints taking their block's default. ValidateTables pins that the tables stay sorted, which the binary search depends on.

Constructors

SignatureNameDescription
CArcBidi() = deleteCArcBidi

Public functions

ReturnsNameDescription
EArcBidiClassClassOf
uint32_tMirrorOf
boolNeedsResolutionWhether the paragraph needs the algorithm at all: true when anything in it is right-to-left or an explicit right-to-left control.
uint8_tParagraphLevel
voidResolveLevelsOne level per codepoint.
voidReorderLineL2 over one line: outVisualToLogical[v] is the logical index drawn at visual position v.
boolValidateTables

Function details

CArcBidi

C++
CArcBidi() = delete

ClassOf

C++
static EArcBidiClass ClassOf(uint32_t codepoint)

MirrorOf

C++
static uint32_t MirrorOf(uint32_t codepoint)

NeedsResolution

C++
static bool NeedsResolution(const uint32_t* codepoints, size_t count)

Whether the paragraph needs the algorithm at all: true when anything in it is right-to-left or an explicit right-to-left control. A paragraph that is all left-to-right resolves to level 0 throughout and the layout skips the work.

ParagraphLevel

C++
static uint8_t ParagraphLevel(const uint32_t* codepoints, size_t count, EArcTextDirection direction)

ResolveLevels

C++
static void ResolveLevels(const uint32_t* codepoints, size_t count, uint8_t paragraphLevel, std::vector<uint8_t>& outLevels)

One level per codepoint. Characters X9 removes (embedding controls, boundary neutrals) take the level of the character before them, so a caller can reorder glyph runs without special-casing them.

ReorderLine

C++
static void ReorderLine(const uint8_t* levels, size_t count, std::vector<uint32_t>& outVisualToLogical)

L2 over one line: outVisualToLogical[v] is the logical index drawn at visual position v. Trailing whitespace is the caller's to reset to the paragraph level first (the line half of L1), since only it knows where the line ends.

ValidateTables

C++
static bool ValidateTables()
Generated from Arc/Text/CArcBidi.h via arc.json · Nov 5, 2026Version 1.0.0