struct

Bidi::ParagraphBidiInfo

Inherits Struct < Value < Object

Single-paragraph bidirectional analysis for UTF-8 text

Simplified API for text known to contain only one paragraph. Provides the same functionality as BidiInfo but with a simpler interface since paragraph handling is not needed.

Properties:

  • text: The original input text (single paragraph)
  • original_classes: BidiClass for each byte in the text
  • levels: Embedding level for each byte in the text
  • paragraph_level: Base embedding level for the paragraph
  • is_pure_ltr: Whether the paragraph contains only LTR content

This matches the Rust ParagraphBidiInfo<'text> struct.

Constructors

new(text : String, original_classes : Array(BidiClass), levels : Array(Level), paragraph_level : Level, is_pure_ltr : Bool)
Source
new(text : String, default_para_level : Level | Nil = nil) : ParagraphBidiInfo

Creates a new ParagraphBidiInfo by analyzing single-paragraph text

Parameters:

  • text: The UTF-8 text to analyze (should be a single paragraph)
  • default_para_level: Optional base paragraph level (nil for auto-detection)

Returns: ParagraphBidiInfo with analysis results

Source
new_with_data_source(data_source : BidiDataSource, text : String, default_para_level : Level | Nil = nil) : ParagraphBidiInfo

Creates a new ParagraphBidiInfo with a custom data source

Lower-level constructor for custom Unicode data sources. Most users should use ParagraphBidiInfo.new() instead.

Parameters:

  • data_source: Custom BidiDataSource for bidi class lookups
  • text: The UTF-8 text to analyze
  • default_para_level: Optional base paragraph level

Returns: ParagraphBidiInfo with analysis results

Source

Class methods

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

Instance methods

direction
Source
has_rtl?
Source
is_pure_ltr
Source
is_pure_ltr=(is_pure_ltr : Bool)
Source
levels
Source
levels=(levels : Array(Level))
Source
original_classes
Source
original_classes=(original_classes : Array(BidiClass))
Source
paragraph_level
Source
paragraph_level=(paragraph_level : Level)
Source
reorder_line(line : Range(Int32, Int32)) : String
Source
reordered_levels(line : Range(Int32, Int32)) : Array(Level)
Source
reordered_levels_per_char(line : Range(Int32, Int32)) : Array(Level)
Source
text
Source
text=(text : String)
Source
visual_runs(line : Range(Int32, Int32)) : Tuple(Array(Level), Array(Range(Int32, Int32)))
Source