getTextWidth: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(Created page with "{{Command|Comments= ____________________________________________________________________________________________ | arma3dev |Game name= |1.97|Game version= _________________...")
 
No edit summary
Line 25: Line 25:
____________________________________________________________________________________________
____________________________________________________________________________________________


| [[ctrlTextHeight]] |SEEALSO=  
| [[ctrlTextWidth]] |SEEALSO=  


|  |MPBEHAVIOUR=  
|  |MPBEHAVIOUR=  

Revision as of 17:25, 7 October 2019

-wrong parameter ("arma3dev") defined!-[[:Category:Introduced with arma3dev version 1.97|1.97]]
Hover & click on the images for description

Description

Description:
Returns estimated width of the text based on font type and size. Similar to ctrlTextWidth but doesn't require a control and can be used to estimate text width for any control including buttons. Result does not include left and right margins (hardcoded at 0.008 each).
Groups:
Uncategorised

Syntax

Syntax:
text getTextWidth [font, size]
Parameters:
text: String - text string to measure
[font, size]: Array
font: String - font type
size: Number - font size
Return Value:
Number

Examples

Example 1:
_textWidth = "Hello World" getTextWidth ["PuristaMedium", 0.03];
Example 2:
_textWidthInclMargins = "Hello World" getTextWidth ["PuristaMedium", 0.03] + 0.016;

Additional Information

See also:
ctrlTextWidth

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note

[[Category:Introduced with arma3dev version 1.97]][[ Category: arma3dev: New Scripting Commands | GETTEXTWIDTH]][[ Category: arma3dev: Scripting Commands | GETTEXTWIDTH]]

Notes

Bottom Section