Difference between revisions of "FontBase:getCharIndexAtOffset"

From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
+
'''Available since:''' Gideros 2018.3.1<br/>
<languages />
+
'''Class:''' [[FontBase]]<br/>
'''<translate>Available since</translate>:''' Gideros 2018.3.1<br/>
+
 
'''<translate>Class</translate>:''' [[Special:MyLanguage/FontBase|FontBase]]<br/>
+
=== Description ===
=== <translate>Description</translate> ===
+
Returns the offset within the given text string to which corresponds the given X offset in the drawn text.
<translate><br />
+
 
Returns the the offset within the given text string to which correponds the given X offset in the drawn text. <br />
+
<syntaxhighlight lang="lua">
<br /></translate>
 
<source lang="lua">
 
 
(number) = FontBase:getCharIndexAtOffset(text,offset,letterSpacing,size)
 
(number) = FontBase:getCharIndexAtOffset(text,offset,letterSpacing,size)
</source>
+
</syntaxhighlight>
=== <translate>Parameters</translate> ===
+
 
'''text''': (string) <translate></translate> <br/>
+
=== Parameters ===
'''offset''': (number) <translate></translate> <br/>
+
'''text''': (string) <br/>
'''letterSpacing''': (number, default = 0) <translate></translate> <br/>
+
'''offset''': (number) <br/>
'''size''': (number, optional) <translate></translate> <br/>
+
'''letterSpacing''': (number, default = 0) <br/>
=== <translate>Return values</translate> ===
+
'''size''': (number, optional) <br/>
'''<translate>Returns</translate>''' (number) <translate>The offset within the text string. The decimal part indicate the relative distance throughout the character itself.</translate><br/>
+
 
 +
=== Return values ===
 +
'''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 15: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.