TextItemGetScale: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Remove spaces)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__
{{Server function}}
This function allows retrieval of the scale or size of a text item.
This function allows retrieval of the scale or size of a text item.


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
float textItemGetScale ( textitem textitem )            
float textItemGetScale ( textitem theTextitem )
</syntaxhighlight>  
</syntaxhighlight>  


===Required Arguments===  
===Required Arguments===  
*'''textitem:''' The text item you wish to retreive the scale of
*'''theTextitem:''' The text item you wish to retrieve the scale of


===Returns===
===Returns===
Line 14: Line 15:


==Example==  
==Example==  
This example retreives the scale of the 'theTextitem' text item, and if it is too small it enlarges it so it is more visible.
This example retrieves the scale of the 'theTextItem' text item, and if it is too small it enlarges it so it is more visible.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
scale = textItemGetScale ( theTextitem )  --get the scale of theTextitem and define it as 'scale'
scale = textItemGetScale ( theTextitem )  -- get the scale of theTextItem and store it in the 'scale' variable
if scale < 0.5 then --if the scale is smaller than 0.5
if scale < 0.5 then                       -- if the scale is smaller than 0.5
     textItemSetScale ( theTextitem, 1.0 ) --then restore it to default size, 1.0.
     textItemSetScale ( theTextItem, 1.0 ) -- then restore it to default size, 1.0.
end
end
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 21:14, 29 October 2023

This function allows retrieval of the scale or size of a text item.

Syntax

float textItemGetScale ( textitem theTextitem )

Required Arguments

  • theTextitem: The text item you wish to retrieve the scale of

Returns

Returns a floating point of the scale of the text. 1.0 is around 12pt.

Example

This example retrieves the scale of the 'theTextItem' text item, and if it is too small it enlarges it so it is more visible.

scale = textItemGetScale ( theTextitem )  -- get the scale of theTextItem and store it in the 'scale' variable
if scale < 0.5 then                       -- if the scale is smaller than 0.5
    textItemSetScale ( theTextItem, 1.0 ) -- then restore it to default size, 1.0.
end

See Also