Table of Contents

FontBase:getAdvanceX

Available since version: 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.

Syntax:

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

Parameters:

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

Return value:

  • number: The width of the first size characters of text.