Search guides and the APICtrl K
  1. API reference
  2. Native GUI

gfx/line_break.h

Where a line of text may end: the Unicode Line Breaking Algorithm (UAX #14).

#include <sonore/gfx/line_break.h>
On this page

Design notes

Why spaces are not enough

Chinese and Japanese have no spaces: a line may end between almost any two ideographs, though not before a closing bracket or a small kana. A hyphen is a place to break after; "$12.50" and "(s)" are not places to break at all; a letter and its accents are one unit, and so is an emoji with its skin tone. Thai, Lao, Khmer and Myanmar have no spaces between words and may not be broken inside one. Wrapping at spaces alone runs a CJK line off its panel and cuts others where no reader would.

What is here

The rules LB1 to LB31 as Unicode 15.0 gives them, with LB1's default resolution and, for numbers, the tailoring UAX #14 gives as Example 7 -- "$(12.35)" and "12.54%" kept whole -- which is what Unicode's own test assumes. That resolution has no dictionary, so a Thai or Khmer word is not split -- they break at spaces, and Font::wrapText breaks a word longer than its line at its clusters. Checked against Unicode's LineBreakTest: all of its cases pass; a sample of it is in tests/data/linebreak.

Functions 1

Enums 1

↑↓ to move↵ to openEvery public name in the headers, and every guide