Difference between revisions of "FontBase:getAdvanceX"

From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2011.6<br/> === Description === <br /> Returns the width of the first `size` characters of `text`. <br /> Note that this value is not...")
 
Line 9: Line 9:
 
<br />
 
<br />
 
<source lang="lua">
 
<source lang="lua">
(number), = FontBase:getAdvanceX(textletterSpacingsize,)
+
(number) = FontBase:getAdvanceX(text,letterSpacing,size)
 
</source>
 
</source>
'''text:''' (string)  ''''''<br/>
+
'''text''': (string)  ''''''<br/>
'''letterSpacing:''' (number, default = 0)  ''''''<br/>
+
'''letterSpacing''': (number, default = 0)  ''''''<br/>
'''size:''' (number, optional)  ''''''<br/>
+
'''size''': (number, optional)  ''''''<br/>
 
'''Returns''' (number) The width of the first size characters of text.<br/>
 
'''Returns''' (number) The width of the first size characters of text.<br/>

Revision as of 10:17, 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)

'text: (string) '
'letterSpacing: (number, default = 0) '
'size: (number, optional) '
Returns (number) The width of the first size characters of text.