Bidi
object Bidi
The Unicode Bidirectional Algorithm (UAX #9), implicit subset: it resolves an embedding level per character and reorders a line from logical to visual order, so mixed Latin + Arabic/Hebrew + numbers display correctly. Lives in core so both the EPUB reflow engine and (later) PDF text extraction can share it.
Scope: a single paragraph with implicit directionality. Not handled (rare in book text, and each a large addition): explicit embedding/override/isolate controls (LRE/RLE/LRI/…), combining-mark reclassification (W1/NSM), and paired-bracket resolution (N0). Arabic/Hebrew combining marks are folded into their base script's strong class, which reorders acceptably.