FontBase:getAdvanceX: Difference between revisions
From GiderosMobile
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
'''Available since:''' Gideros 2011.6<br/> | |||
'''Class:''' [[FontBase]]<br/> | |||
''' | |||
''' | === Description === | ||
=== | Returns the width of the first ''size'' characters of ''text''. | ||
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()''. | ||
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 <br /> | ''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. | whereas ''getAdvanceX()'' returns the distance to where the next string should be drawn. | ||
<source lang="lua"> | <source lang="lua"> | ||
(number) = FontBase:getAdvanceX(text,letterSpacing,size) | (number) = FontBase:getAdvanceX(text,letterSpacing,size) | ||
</source> | </source> | ||
=== | |||
'''text''': (string) | === Parameters === | ||
'''letterSpacing''': (number, default = 0) | '''text''': (string) <br/> | ||
'''size''': (number, optional) | '''letterSpacing''': (number, default = 0) <br/> | ||
=== | '''size''': (number, optional) <br/> | ||
''' | |||
=== Return values === | |||
'''Returns''' (number) The width of the first size characters of text.<br/> | |||
---- | |||
{{Special:PrefixIndex/FontBase:}} | |||
<br/> | |||
{{Special:PrefixIndex/FontBase.TLF}} | |||
<br/> | |||
Revision as of 20:18, 2 December 2019
Available since: Gideros 2011.6
Class: FontBase
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.