struct

Bidi::UTF16::BidiInfo

Inherits Bidi::BidiInfoCommon < Struct < Value < Object

Bidi information of the text (UTF-16 version). Main structure for bidirectional analysis of UTF-16 text

UTF-16 variant of Bidi::BidiInfo that operates on Array(UInt16) instead of String. Handles surrogate pairs correctly in all operations.

Properties:

  • text: The original input text as UTF-16 code units
  • original_classes: BidiClass for each code unit in the text
  • levels: Embedding level for each code unit in the text
  • paragraphs: Information about each paragraph in the text

This matches the Rust BidiInfo<'text> struct in the utf16 module.

Constructors

new(text : Array(UInt16), original_classes : Array(BidiClass), levels : Array(Level), paragraphs : Array(ParagraphInfo))
Source
new(text : Array(UInt16), default_para_level : Level | Nil = nil) : BidiInfo

Creates a new UTF16::BidiInfo by analyzing UTF-16 text

Parameters:

  • text: UTF-16 encoded text as Array(UInt16)
  • default_para_level: Optional base paragraph level (nil for auto-detection)

Returns: UTF16::BidiInfo with analysis results

Source
new_with_data_source(data_source : BidiDataSource, text : Array(UInt16), default_para_level : Level | Nil = nil) : BidiInfo

Creates a new UTF16::BidiInfo with a custom data source

Lower-level constructor for custom Unicode data sources.

Parameters:

  • data_source: Custom BidiDataSource for bidi class lookups
  • text: UTF-16 encoded text as Array(UInt16)
  • default_para_level: Optional base paragraph level

Returns: UTF16::BidiInfo with analysis results

Source

Class methods

reorder_visual(levels : Array(Level)) : Array(Int32)
Source

Instance methods

levels
Source
levels=(levels : Array(Level))
Source
original_classes
Source
original_classes=(original_classes : Array(BidiClass))
Source
paragraphs
Source
paragraphs=(paragraphs : Array(ParagraphInfo))
Source
reorder_line(para : ParagraphInfo, line : Range(Int32, Int32)) : Array(UInt16)

Reorders a line of UTF-16 text for visual display

UTF-16 variant of BidiInfo.reorder_line that returns Array(UInt16) instead of String. Handles surrogate pairs correctly when reversing RTL text (preserves high/low surrogate order).

Parameters:

  • para: The paragraph containing the line
  • line: Code unit range within the UTF-16 text

Returns: Reordered UTF-16 code units as Array(UInt16)

Source
reordered_levels(para : ParagraphInfo, line : Range(Int32, Int32)) : Array(Level)
Source
reordered_levels_per_char(para : ParagraphInfo, line : Range(Int32, Int32)) : Array(Level)
Source
text
Source
text=(text : Array(UInt16))
Source
visual_runs(para : ParagraphInfo, line : Range(Int32, Int32)) : Tuple(Array(Level), Array(Range(Int32, Int32)))
Source