Difference between revisions of "FontBase:getCharIndexAtOffset"
From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>") |
|||
(8 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | |||
'''Available since:''' Gideros 2018.3.1<br/> | '''Available since:''' Gideros 2018.3.1<br/> | ||
+ | '''Class:''' [[FontBase]]<br/> | ||
+ | |||
=== Description === | === Description === | ||
− | + | Returns the offset within the given text string to which corresponds the given X offset in the drawn text. | |
− | Returns | + | |
− | + | <syntaxhighlight lang="lua"> | |
− | < | ||
(number) = FontBase:getCharIndexAtOffset(text,offset,letterSpacing,size) | (number) = FontBase:getCharIndexAtOffset(text,offset,letterSpacing,size) | ||
− | </ | + | </syntaxhighlight> |
+ | |||
=== Parameters === | === Parameters === | ||
− | '''text''': (string) | + | '''text''': (string) <br/> |
− | '''offset''': (number) | + | '''offset''': (number) <br/> |
− | '''letterSpacing''': (number, default = 0) | + | '''letterSpacing''': (number, default = 0) <br/> |
− | '''size''': (number, optional) | + | '''size''': (number, optional) <br/> |
+ | |||
=== Return values === | === Return values === | ||
'''Returns''' (number) The offset within the text string. The decimal part indicate the relative distance throughout the character itself.<br/> | '''Returns''' (number) The offset within the text string. The decimal part indicate the relative distance throughout the character itself.<br/> | ||
+ | |||
+ | {{FontBase}} |
Latest revision as of 14:29, 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.
(number) = FontBase:getCharIndexAtOffset(text,offset,letterSpacing,size)
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.