Commit graph imsd-messages/tests/Wrap/main.cpp
Author SHA1 Message Date
335b27b72d
Wrap: word wrap and ellipsis over a measure function
Crafter.Graphics shapes one line at a time and drops newlines, so the app
breaks text itself: a greedy wrap with breaks after spaces and hyphens
(a space that itself overflows ends the line after the words that fit,
and opens no line of its own when it ends the text or a newline
follows; one at a line's start is no break at all, nor is a run of
them: a break is recorded only once the line holds a word, and a run of
spaces wider than the line splits like a word, with the same rule at the
text's end and before a newline), hard breaks at
newlines, over-long words split between code points, and
the run of spaces where a line wraps left out of both lines. Results are
cached per (text, width, size). The measure is a function, so the caller
supplies the advances; the tests use a constant ten-pixel advance.

Tested: tests/Wrap on a ten-pixel monospace measure, a leading run of
spaces among the cases.
2026-11-17 06:14:18 +01:00