Part of TPG namespace
TPG.UI.Wrap(text, font, maxW, maxLines)Description
Break text into lines that each fit a width, splitting between words. TPG.UI.Truncate is the right answer for a NAME: one line, an ellipsis, the full text a tooltip away. It is the wrong answer for a SENTENCE. The loadout menu's slot descriptions explain what a cooldown actually costs you, and a single line cut them at "until it runs out you spawn with the fre...", the setup with the answer missing, and nowhere else to read it. A word wider than the whole box gets a clipped line of its own (via Truncate) rather than being dropped or looping forever; a weapon pack is free to ship one. maxLines caps the block, because this text sits above a grid and a long description must not be able to push the grid off the panel. Everything past the cap is folded back onto the last line kept, so the ellipsis lands where the text really stops rather than at the end of a line that happened to fit. the tail is folded onto the last line and truncated with an ellipsis. (returns { "" }).
Parameters
| Name | Type | Description |
|---|---|---|
text | string | |
font | string | A font name already created by `TPG.UI.BuildFonts`. |
maxW | number | Maximum width per line, in pixels. |
maxLines? | number | If given, caps the number of lines returned; |
Returns
| Type | Description |
|---|---|
{string,...} | At least one line, even for an empty/nil `text` |
Examples
No examples available.
Used In
No usages found in the codebase.