Struct BidiRun
A run of UTF-16 units at one embedding level.
public readonly record struct BidiRun : IEquatable<BidiRun>
- Implements
- Inherited Members
Examples
// A Hebrew word inside English text: three runs, the middle one drawn right to left.
string text = "abc \u05D0\u05D1\u05D2 def";
using BidiResult result = Bidi.Resolve(text, TextDirection.Auto);
int paragraph = result.ParagraphLevel; // 0: the first strong character is Latin
foreach (BidiRun run in result.Reorder(0, result.Length))
{
Console.WriteLine($"{run.Start}+{run.Length} {(run.IsRightToLeft ? "right to left" : "left to right")}");
}
Constructors
BidiRun(int, int, int)
A run of UTF-16 units at one embedding level.
public BidiRun(int Start, int Length, int Level)
Parameters
StartintThe index of the run's first UTF-16 unit.
LengthintThe number of UTF-16 units.
LevelintThe embedding level: even for left to right, odd for right to left.
Examples
// A Hebrew word inside English text: three runs, the middle one drawn right to left.
string text = "abc \u05D0\u05D1\u05D2 def";
using BidiResult result = Bidi.Resolve(text, TextDirection.Auto);
int paragraph = result.ParagraphLevel; // 0: the first strong character is Latin
foreach (BidiRun run in result.Reorder(0, result.Length))
{
Console.WriteLine($"{run.Start}+{run.Length} {(run.IsRightToLeft ? "right to left" : "left to right")}");
}
Properties
IsRightToLeft
Gets whether the run is drawn right to left (its level is odd).
public bool IsRightToLeft { get; }
Property Value
Length
The number of UTF-16 units.
public int Length { get; init; }
Property Value
Level
The embedding level: even for left to right, odd for right to left.
public int Level { get; init; }
Property Value
Start
The index of the run's first UTF-16 unit.
public int Start { get; init; }