Enum LineBreakStrictness
How strictly line breaks follow Chinese and Japanese rules (CSS line-break): breaks before small kana, hyphens,
iteration marks and some punctuation.
public enum LineBreakStrictness
Fields
Anywhere = 4A break between any two grapheme clusters, ignoring every rule except the hard breaks.
Auto = 0CSS's default, the same as Normal, as browsers break.
Loose = 1The most lenient rules: also breaks before iteration marks, centred punctuation, suffixes and between inseparable characters in Chinese and Japanese.
Normal = 2The common rules: breaks before small kana, and before the hyphens U+2010, U+2013, U+301C and U+30A0 in Chinese and Japanese.
Strict = 3The strictest rules, which are UAX #14's own: never breaks before small kana (class CJ) or the hyphens Normal lets start a 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
}