Table of Contents

Struct BidiRun

Namespace
Egami.Fonts.Unicode
Assembly
Egami.Fonts.dll

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

Start int

The index of the run's first UTF-16 unit.

Length int

The number of UTF-16 units.

Level int

The 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

bool

Length

The number of UTF-16 units.

public int Length { get; init; }

Property Value

int

Level

The embedding level: even for left to right, odd for right to left.

public int Level { get; init; }

Property Value

int

Start

The index of the run's first UTF-16 unit.

public int Start { get; init; }

Property Value

int