Function unicode_bidi::reorder_visual

source ยท
pub(crate) fn reorder_visual(levels: &[Level]) -> Vec<usize>
Expand description

Reorders pre-calculated levels of a sequence of characters.

NOTE: This is a convenience method that does not use a Paragraph object. It is intended to be used when an application has determined the levels of the objects (character sequences) and just needs to have them reordered.

the index map will result in indexMap[visualIndex]==logicalIndex.

This only runs Rule L2 as it does not have information about the actual text.

Furthermore, if levels is an array that is aligned with code units, bytes within a codepoint may be reversed. You may need to fix up the map to deal with this. Alternatively, only pass in arrays where each Level is for a single code point.