Difference between revisions of "FontBase:getAdvanceX"

From GiderosMobile
Line 3: Line 3:
 
=== Description ===
 
=== Description ===
 
<translate><br />
 
<translate><br />
Returns the width of the first [[size]] characters of [[text]]. <br />
+
Returns the width of the first [[Special:MyLanguage/size|size]] characters of [[Special:MyLanguage/text|text]]. <br />
Note that this value is not equal to the 3rd return value (width) of [[getBounds()]]. <br />
+
Note that this value is not equal to the 3rd return value (width) of [[Special:MyLanguage/getBounds()|getBounds()]]. <br />
[[getBounds()]] returns a rectangle describing the bounds this string will cover <br />
+
[[Special:MyLanguage/getBounds()|getBounds()]] returns a rectangle describing the bounds this string will cover <br />
whereas [[getAdvanceX()]] returns the distance to where the next string should be drawn.<br />
+
whereas [[Special:MyLanguage/getAdvanceX()|getAdvanceX()]] returns the distance to where the next string should be drawn.<br />
 
<br /></translate>
 
<br /></translate>
 
<source lang="lua">
 
<source lang="lua">

Revision as of 17:35, 23 August 2018

Available since: Gideros 2011.6

Description


Returns the width of the first size characters of text.
Note that this value is not equal to the 3rd return value (width) of getBounds().
getBounds() returns a rectangle describing the bounds this string will cover
whereas getAdvanceX() returns the distance to where the next string should be drawn.

(number) = FontBase:getAdvanceX(text,letterSpacing,size)

Parameters

text: (string)
letterSpacing: (number, default = 0)
size: (number, optional)

Return values

Returns (number) The width of the first size characters of text.