layoutText
Soft-wraps a string into lines that fit within maxWidth.
The algorithm preserves hard line breaks (\n) and otherwise breaks on whitespace using a greedy first-fit strategy: each word is appended to the current line if it still fits, otherwise it starts a new line. Within a word, soft hyphens (U+00AD) mark extra break opportunities — when one is taken, a visible hyphen is emitted at the line end. Words longer than maxWidth with no usable break point are split mid-word so narrow containers never overflow horizontally.
After wrapping, TextStyle.maxLines truncates the paragraph (optionally ellipsizing the last visible line per TextStyle.overflow) and TextAlign.Justify distributes the leftover slack of every non-final line between its words.
Return
a MeasuredText containing every wrapped line, the resolved style, and the total occupied size of the block.
Parameters
input string. Tabs are not interpreted.
style applied uniformly to every glyph. Used both to measure widths and to compute line height.
available horizontal space in PDF points.
platform-provided text measurement service.