Difference between revisions of "FontBase:getAdvanceX"

From GiderosMobile
m
m (Text replacement - "<source" to "<syntaxhighlight")
Line 9: Line 9:
 
''getBounds()'' returns a rectangle describing the bounds this string will cover whereas ''getAdvanceX()'' returns the distance to where the next string should be drawn.
 
''getBounds()'' returns a rectangle describing the bounds this string will cover whereas ''getAdvanceX()'' returns the distance to where the next string should be drawn.
  
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
(number) = FontBase:getAdvanceX(text,letterSpacing,size)
 
(number) = FontBase:getAdvanceX(text,letterSpacing,size)
 
</source>
 
</source>

Revision as of 15:28, 13 July 2023

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.

<syntaxhighlight lang="lua"> (number) = FontBase:getAdvanceX(text,letterSpacing,size) </source>

Parameters

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

Return values

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