Difference between revisions of "Legacy:Font/getStringHeight"

From Spherical
Jump to: navigation, search
(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}}
  
* '''param1''' type. param1 description
+
* '''text''' string. The text to calculate the word-wrapped height of
* '''param2''' type. param2 description
+
* '''width''' integer. The pixel width of the box in which word-wrapping occurs
* '''paramN''' type. paramN description
 
  
 
==Examples==
 
==Examples==
(examples with syntaxhighlighted code)
+
The third example of [[API:Font/drawTextBox|Font.drawTextBox]]() contains a useful application of this function.
  
 
==Notes==
 
==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==
* see also
+
* Sphere [[API:Font|Font]] object
* see also
+
* [[API:Font/drawText|Font.drawText]]()
* see also
+
* [[API:Font/drawTextBox|Font.drawTextBox]]()
* etc
+
* [[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().

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

API:Font/navbox