Table of Contents

Enum WordBreak

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

Where breaks may fall inside words (CSS word-break).

public enum WordBreak

Fields

BreakAll = 1

Letters and digits of any script break like ideographs, between any two.

KeepAll = 2

Ideographs, kana and Hangul keep together like the letters of a word, as Korean text with spaces wants.

Normal = 0

Unicode's rules: words break at spaces and punctuation, ideographs between any two.

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
}