Difference between revisions of "Font:getWidth"

(Fixes type of line)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Determines the horizontal size a line of text needs.
+
Determines the maximum width (accounting for newlines) taken by the given string.
Does not support line-breaks.
 
 
== Function ==
 
== Function ==
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">
width = Font:getWidth( line )
+
width = font:getWidth( text )
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
{{param|string|line|A line of text.}}
+
{{param|string|text|A string.}}
 
=== Returns ===
 
=== Returns ===
{{param|number|width|The width of the line.}}
+
{{param|number|width|The width of the text.}}
 
== See Also ==
 
== See Also ==
 
* [[parent::Font]]
 
* [[parent::Font]]
 +
* [[Font:getHeight]]
 
[[Category:Functions]]
 
[[Category:Functions]]
{{#set:Description=Determines the horizontal size a line of text needs. }}
+
{{#set:Description=Determines the width of the given text. }}
 
{{#set:Since=000}}
 
{{#set:Since=000}}
 +
 
== Other Languages ==
 
== Other Languages ==
 
{{i18n|Font:getWidth}}
 
{{i18n|Font:getWidth}}

Latest revision as of 16:39, 26 March 2021

Determines the maximum width (accounting for newlines) taken by the given string.

Function

Synopsis

width = font:getWidth( text )

Arguments

string text
A string.

Returns

number width
The width of the text.

See Also


Other Languages