Enum OverflowWrap
Whether a piece wider than its line may break anywhere (CSS overflow-wrap).
public enum OverflowWrap
Fields
Anywhere = 1An overflowing piece breaks between grapheme clusters, and the narrowest piece the text can be broken into counts that way too.
BreakWord = 2An overflowing piece breaks between grapheme clusters; the narrowest width still counts whole pieces.
Normal = 0An 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
}