Difference between revisions of "Font:getWrap"

m
m (Improve description of return)
Line 15: Line 15:
 
=== Returns ===
 
=== Returns ===
 
{{param|number|width|The maximum width of the wrapped text.}}
 
{{param|number|width|The maximum width of the wrapped text.}}
{{param|table|wrappedtext|A table containing each line of text that was wrapped.}}
+
{{param|table|wrappedtext|A [[sequence]] containing each line of text that was wrapped.}}
  
 
== Function ==
 
== Function ==

Revision as of 23:31, 23 September 2016

Available since LÖVE 0.7.0
This function is not supported in earlier versions.

Gets formatting information for text, given a wrap limit.

This function accounts for newlines correctly (i.e. '\n').

Function

Available since LÖVE 0.10.0
This variant is not supported in earlier versions.

Synopsis

width, wrappedtext = Font:getWrap( text, wraplimit )

Arguments

string text
The text that will be wrapped.
number wraplimit
The maximum width in pixels of each line that text is allowed before wrapping.

Returns

number width
The maximum width of the wrapped text.
table wrappedtext
A sequence containing each line of text that was wrapped.

Function

Removed in LÖVE 0.10.0
This variant is not supported in that and later versions.

Synopsis

width, lines = Font:getWrap( text, wraplimit )

Arguments

string text
The text that would be wrapped.
number wraplimit
The maximum width in pixels of each line that text is allowed before wrapping.

Returns

number width
The maximum width of the wrapped text.
number lines
The number of lines that the wrapped text will have.

See Also

Other Languages