Font:getWidth
Returns the width and line count of a string when rendered using the font, taking into account an optional wrap limit.
width, lines = Font:getWidth(text, wrap)
Arguments
Name | Type | Default | Description |
text | string | The text to get the width of. | |
wrap | number | 0 | The width at which to wrap lines, or 0 for no wrap. |
Returns
Name | Type | Description |
width | number | The maximum width of any line in the text. |
lines | number | The number of lines in the wrapped text. |
Notes
To get the correct units returned, make sure the pixel density is set with
Font:setPixelDensity
.
See also
Font