FontBase:getCharIndexAtOffset: Difference between revisions
From GiderosMobile
mNo edit summary |
m Text replacement - "<source" to "<syntaxhighlight" |
||
| Line 5: | Line 5: | ||
Returns the offset within the given text string to which corresponds the given X offset in the drawn text. | Returns the offset within the given text string to which corresponds the given X offset in the drawn text. | ||
< | <syntaxhighlight lang="lua"> | ||
(number) = FontBase:getCharIndexAtOffset(text,offset,letterSpacing,size) | (number) = FontBase:getCharIndexAtOffset(text,offset,letterSpacing,size) | ||
</source> | </source> | ||
Revision as of 13:28, 13 July 2023
Available since: Gideros 2018.3.1
Class: FontBase
Description
Returns the offset within the given text string to which corresponds the given X offset in the drawn text.
<syntaxhighlight lang="lua"> (number) = FontBase:getCharIndexAtOffset(text,offset,letterSpacing,size) </source>
Parameters
text: (string)
offset: (number)
letterSpacing: (number, default = 0)
size: (number, optional)
Return values
Returns (number) The offset within the text string. The decimal part indicate the relative distance throughout the character itself.