module

Bidi

Constants

VERSION = "0.1.0"

Class methods

bidi_class(c : Char) : BidiClass

Forward common functions

Source
compute_explicit(text : String, para_level : Level, original_classes : Array(BidiClass), levels : Array(Level), processing_classes : Array(BidiClass), runs : Array(LevelRun), start : Int32 = 0, size : Int32 | Nil = nil) : Nil

Compute explicit embedding levels for one paragraph of text (X1-X8), and identify level runs (BD7) for use when determining Isolating Run Sequences (X10).

processing_classes[i] must contain the BidiClass of the char at byte index i, for each char in text.

runs returns the list of level runs (BD7) of the text.

Source
get_base_direction(text : String) : Direction
Source
get_base_direction_full(text : String) : Direction
Source
get_base_direction_full_with_data_source(data_source : BidiDataSource, text : String) : Direction
Source
get_base_direction_with_data_source(data_source : BidiDataSource, text : String) : Direction
Source
identify_bracket_pairs(text : String, data_source : BidiDataSource, run_sequence : IsolatingRunSequence, processing_classes : Array(BidiClass), bracket_pairs : Array(BracketPair)) : Nil

3.1.3 Identifying Bracket Pairs

Returns all paired brackets in the source, as indices into the text source.

https://www.unicode.org/reports/tr9/#BD16

Source
isolating_run_sequences(para_level : Level, original_classes : Array(BidiClass), levels : Array(Level), runs : Array(LevelRun), has_isolate_controls : Bool, isolating_run_sequences : Array(IsolatingRunSequence), start : Int32 = 0) : Nil

Compute the set of isolating run sequences.

An isolating run sequence is a maximal sequence of level runs such that for all level runs except the last one in the sequence, the last character of the run is an isolate initiator whose matching PDI is the first character of the next level run in the sequence.

Note: This function does not return the sequences in order by their first characters.

Source
level_runs(levels : Array(Level), original_classes : Array(BidiClass)) : Array(LevelRun)

Find the level runs in a paragraph.

This is step X9 of the algorithm.

Source
ni?(bidi_class : BidiClass) : Bool

Neutral or Isolate formatting character (B, S, WS, ON, FSI, LRI, RLI, PDI)

http://www.unicode.org/reports/tr9/#NI

Source
not_removed_by_x9(bidi_class : BidiClass) : Bool

For use as a predicate for position / rposition

Source
removed_by_x9(bidi_class : BidiClass) : Bool

Should this character be ignored in steps after X9?

http://www.unicode.org/reports/tr9/#X9

Source
resolve_levels(processing_classes : Array(BidiClass), levels : Array(Level), start : Int32 = 0, size : Int32 | Nil = nil) : Level
Source
resolve_neutral(data_source : BidiDataSource, text : String, sequence : IsolatingRunSequence, levels : Array(Level), original_classes : Array(BidiClass), processing_classes : Array(BidiClass)) : Nil
Source
resolve_weak(text : String, sequence : IsolatingRunSequence, processing_classes : Array(BidiClass), start : Int32 = 0) : Nil
Source
rtl?(bidi_class : BidiClass) : Bool
Source

Nested types