public static class LineBreakerWhere a line may be broken, and where it must be.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
UAX#14. Not "break at spaces": a hyphen offers a break and a non-breaking hyphen does not, 1,000 must not split at the comma, an opening bracket keeps what follows it, CJK breaks almost anywhere, and Korean does not break inside a syllable. Wrapping done on spaces alone looks wrong in English and is unusable in half the world's scripts.
This is the opportunity finder. It says where a break is permitted and where one is mandatory; deciding which of the permitted ones to take is line filling, which needs measured widths and is the layout pass's job. Keeping them apart is what lets this be judged by the conformance suite at all — the suite is about opportunities and knows nothing about fonts.
The returned positions do not include zero, unlike the segmentation breakers. That is not an inconsistency: LB2 says never break at the start of text, so position zero is not an opportunity, and the conformance data says so too by opening every case with a prohibition rather than a break.
Methods (3)
public static void Collect(ReadOnlySpan<char> text, List<int> opportunities)Collects every line break opportunity in a string.
public static List<int> Opportunities(string text)Every line break opportunity in a string.
public static bool IsMandatory(ReadOnlySpan<char> text, int index)Whether a break at a position is mandatory rather than merely permitted.
Used by (3)
- LineBreakConformanceTestsVixen.Ui.Text.Tests
- LineBreakTestsVixen.Ui.Text.Tests
- LineWrapperVixen.Ui.Text