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 unitsoriginal_classes: BidiClass for each code unit in the textlevels: Embedding level for each code unit in the textparagraphs: Information about each paragraph in the text
This matches the Rust BidiInfo<'text> struct in the utf16 module.
Constructors
Creates a new UTF16::BidiInfo by analyzing UTF-16 text
Parameters:
text: UTF-16 encoded text asArray(UInt16)default_para_level: Optional base paragraph level (nil for auto-detection)
Returns: UTF16::BidiInfo with analysis results
Creates a new UTF16::BidiInfo with a custom data source
Lower-level constructor for custom Unicode data sources.
Parameters:
data_source: CustomBidiDataSourcefor bidi class lookupstext: UTF-16 encoded text asArray(UInt16)default_para_level: Optional base paragraph level
Returns: UTF16::BidiInfo with analysis results
Class methods
Instance methods
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 lineline: Code unit range within the UTF-16 text
Returns: Reordered UTF-16 code units as Array(UInt16)