BidiText
The result of the bidirectional analysis of a text.
The analysis resolves embedding levels for whole paragraphs, reordering happens per line. A typical use is:
shape every run returned by runs using its direction and script
break lines on the shaped runs (in logical order)
call visualRuns for every line to find the order in which the line's runs are displayed
All indices are UTF-16 indices into text, line ranges are half-open (lineEnd is exclusive).
Properties
Functions
Returns the embedding levels for the line [lineStart, lineEnd) after applying rule L1: segment separators, paragraph separators and trailing whitespace are reset to the paragraph level.
Returns the paragraph containing the UTF-16 index
Returns the resolved script of the character at UTF-16 index. Characters of the Common and Inherited scripts are resolved to the script of the surrounding text, they are only reported as Script.COMMON or Script.INHERITED when the paragraph has no other script.
Returns the visual order of the line [lineStart, lineEnd) (rules L1 and L2): element i is the UTF-16 index of the unit displayed at visual position i, from left to right. Surrogate pairs are kept in logical order. Characters are not mirrored, see BidiTextDriver.mirroredCodePoint.
Returns the runs of the line [lineStart, lineEnd) in visual order, from left to right, with levels after rule L1. The characters of a run with a right-to-left BidiRun.direction are displayed right to left; shaping such a run with Direction.RIGHT_TO_LEFT produces glyphs in visual order.