Back to API Reference
Class
BalanceModifier
Wraps the paragraphs of the range balanced: as many lines as greedy wrapping takes, each about as long.
Remarks
The CSS text-wrap: balance of headings, titles, buttons and captions: the last line no longer holds one lonely word. A paragraph the range touches is balanced when greedy wrapping breaks it into two to six lines; a longer paragraph, a paragraph inside a table and text that does not wrap keep greedy wrapping. Lines keep their alignment in the full width of the text box, and auto-size chooses its font size before balancing. With an EllipsisModifier or TruncateModifier on the component the text wraps greedy, so a cut keeps as much text as greedy wrapping shows; a line-based reveal counts the balanced lines. Pair with a TagRule (conventional tag name balance) or apply it to the whole text.
protected override void ApplyRange(UniTextBuffers buffers, TextRange range)