Module text_break
Expand description
Unicode line-break opportunities shared by shaping-adjacent layout code.
RichTextLayout receives UAX #14 behavior from cosmic-text. Components
that must build matching row metadata or return individually clamped lines
use this module instead of guessing at ASCII spaces.
Enums§
- Line
Break Kind - Whether a UAX #14 opportunity permits or requires a break.
Functions§
- discretionary_
hyphen_ breaks - UTF-8 byte offsets at which TeX/Liang patterns permit a discretionary
hyphen for
language. The source text is never modified; callers decide whether a chosen line break should paint the hyphen glyph. - grapheme_
indices - Extended grapheme clusters (UAX #29) paired with their starting byte offset, so combining marks, emoji modifiers, flags and ZWJ sequences stay whole. Offsets address the original UTF-8 string and each slice is a complete UAX #29 cluster, using the same ICU rules as toolkit selection.
- line_
break_ opportunities - Iterate byte offsets where a line may or must end according to Unicode Standard Annex #14. Every offset is a UTF-8 boundary and the final text boundary is always returned as mandatory.
- unicode_
word_ ranges - Return Unicode word-like spans in original UTF-8 byte coordinates. Uses the same ICU segmentation as toolkit word selection and movement.