Difference between revisions of "Legacy:Font/getStringHeight"
From Spherical
(created from http://web.archive.org/web/20110911100956/http://www.spheredev.org/wiki/Font.getStringHeight) |
(filled) |
||
Line 1: | Line 1: | ||
− | |||
− | |||
Get the pixel height of word-wrapped text that would be drawn with [[API:Font/drawTextBox|Font.drawTextBox]](). | Get the pixel height of word-wrapped text that would be drawn with [[API:Font/drawTextBox|Font.drawTextBox]](). | ||
Line 8: | Line 6: | ||
{{Usage|returns=integer|object=Font|func=getStringHeight|params=text, width}} | {{Usage|returns=integer|object=Font|func=getStringHeight|params=text, width}} | ||
− | * ''' | + | * '''text''' string. The text to calculate the word-wrapped height of |
− | * ''' | + | * '''width''' integer. The pixel width of the box in which word-wrapping occurs |
− | |||
==Examples== | ==Examples== | ||
− | ( | + | The third example of [[API:Font/drawTextBox|Font.drawTextBox]]() contains a useful application of this function. |
==Notes== | ==Notes== | ||
− | ( | + | * This function can be used to figure out the right number for the <var>y_offset</var> argument of the [[API:Font/drawTextBox|Font.drawTextBox]]() function. |
==See also== | ==See also== | ||
− | * | + | * Sphere [[API:Font|Font]] object |
− | * | + | * [[API:Font/drawText|Font.drawText]]() |
− | * | + | * [[API:Font/drawTextBox|Font.drawTextBox]]() |
− | * | + | * [[API:Font/getHeight|Font.getHeight]]() |
+ | * [[API:Font/getStringWidth|Font.getStringWidth]]() | ||
{{API:Font/navbox}} | {{API:Font/navbox}} |
Latest revision as of 22:50, 24 June 2013
Get the pixel height of word-wrapped text that would be drawn with Font.drawTextBox().
Contents
Usage
integer Font.getStringHeight(text, width);
- text string. The text to calculate the word-wrapped height of
- width integer. The pixel width of the box in which word-wrapping occurs
Examples
The third example of Font.drawTextBox() contains a useful application of this function.
Notes
- This function can be used to figure out the right number for the y_offset argument of the Font.drawTextBox() function.
See also
- Sphere Font object
- Font.drawText()
- Font.drawTextBox()
- Font.getHeight()
- Font.getStringWidth()