enum SoftWrap
Swift
enum SoftWrap
Greedy line breaking.
Takes measured advances rather than doing any measuring itself, which is
what keeps it in LavaText: the caller supplies one advance per Character
and this decides where the breaks fall. Synthetic advances make every rule
below testable without a font.
Sources/LavaText/SoftWrap.swift:9
Methods
static func rows(text: String, advances: [Float], maxWidth: Float) -> [Range<Int>]
Splits text into row ranges (character offsets, relative to text)
that each fit within maxWidth.
Always returns at least one row, even for empty input — the caret has to have somewhere to sit.
Sources/LavaText/SoftWrap.swift:15