Table of Contents

Struct TextSpan

Namespace
Egami.Fonts.Shaping
Assembly
Egami.Fonts.dll

A range of text with its own font, language or features, for Spans.

public readonly record struct TextSpan : IEquatable<TextSpan>
Implements
Inherited Members

Examples

// A styled range: its own font, language or features.
var options = new ShapingOptions
{
    Language = "en",
    Spans = [new TextSpan(6, 6) { Font = font with { Kerning = false }, Features = [FontFeature.SmallCaps] }],
};
ShapedText shaped = TextShaper.Shape("Hello, World", font, options);

Constructors

TextSpan(int, int)

A range of text with its own font, language or features, for Spans.

public TextSpan(int Start, int Length)

Parameters

Start int

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

Length int

The number of UTF-16 units.

Examples

// A styled range: its own font, language or features.
var options = new ShapingOptions
{
    Language = "en",
    Spans = [new TextSpan(6, 6) { Font = font with { Kerning = false }, Features = [FontFeature.SmallCaps] }],
};
ShapedText shaped = TextShaper.Shape("Hello, World", font, options);

Properties

Features

Gets feature settings applied after the options' features, or null.

public IReadOnlyList<FontFeature>? Features { get; init; }

Property Value

IReadOnlyList<FontFeature>

Font

Gets the span's font, or null for the font the text is shaped with.

public Font? Font { get; init; }

Property Value

Font?

Language

Gets the span's BCP 47 language tag, or null for the options' language.

public string? Language { get; init; }

Property Value

string

Length

The number of UTF-16 units.

public int Length { get; init; }

Property Value

int

Start

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

public int Start { get; init; }

Property Value

int