Table of Contents

Enum OverflowWrap

Namespace
Egami.Fonts.Layout
Assembly
Egami.Fonts.dll

Whether a piece wider than its line may break anywhere (CSS overflow-wrap).

public enum OverflowWrap

Fields

Anywhere = 1

An overflowing piece breaks between grapheme clusters, and the narrowest piece the text can be broken into counts that way too.

BreakWord = 2

An overflowing piece breaks between grapheme clusters; the narrowest width still counts whole pieces.

Normal = 0

An unbreakable piece overflows its line.

Examples

// Where lines may end: after spaces and hyphens, and always at the end; a line must end after a newline.
List<int> breaks = [];
foreach (LineBreak b in LineBreaks.Enumerate("A well-known fact.\nNext"))
{
    breaks.Add(b.Index);                       // 2, 7, 13, 19 (mandatory), 23
}

// CSS switches: break-all lets letters break like ideographs.
LineBreakOptions breakAll = new(WordBreak: WordBreak.BreakAll);
int count = 0;
foreach (LineBreak b in LineBreaks.Enumerate("word", breakAll))
{
    count++;                                   // 4: after every letter
}