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§
- bidi_
info - The Unicode Bidirectional Algorithm (UAX #9) run over
textwith its paragraph direction taken from its first strong character: the embedding level of every byte and the paragraphs, for code that orders a line’s runs itself. - builtin_
hyphenation - TeX/Liang hyphenation by the patterns hypher embeds.
- 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.
- hyphenation_
generation - How many times the patterns arrived: never, as they were always there.
- 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.
Type Aliases§
- Hyphenate
- Calls
outwith the byte offset inwordafter each of its syllables but the last, bylang’s patterns. - Make
Hyphenation - Hands over the patterns’
Hyphenate, forinstall_hyphenation.