Difference between revisions of "Font:getWrap"
m |
(Updated for 0.10.0) |
||
Line 1: | Line 1: | ||
{{newin|[[0.7.0]]|070|type=function}} | {{newin|[[0.7.0]]|070|type=function}} | ||
− | + | Gets formatting information for text, given a wrap limit. | |
+ | |||
This function accounts for newlines correctly (i.e. '\n') | This function accounts for newlines correctly (i.e. '\n') | ||
+ | |||
== Function == | == Function == | ||
+ | {{newin|[[0.10.0]]|100|type=variant}} | ||
=== Synopsis === | === Synopsis === | ||
<source lang="lua"> | <source lang="lua"> | ||
− | width, lines = Font:getWrap(text, | + | width, wrappedtext = Font:getWrap( text, wraplimit ) |
+ | </source> | ||
+ | === Arguments === | ||
+ | {{param|string|text|The text that will be wrapped.}} | ||
+ | {{param|number|wraplimit|The maximum width in pixels of each line that ''text'' is allowed before wrapping.}} | ||
+ | === Returns === | ||
+ | {{param|number|width|The maximum width of the wrapped text.}} | ||
+ | {{param|table|wrappedtext|A table containing each line of text that was wrapped.}} | ||
+ | |||
+ | == Function == | ||
+ | {{oldin|[[0.10.0]]|100|type=variant}} | ||
+ | === Synopsis === | ||
+ | <source lang="lua"> | ||
+ | width, lines = Font:getWrap( text, wraplimit ) | ||
</source> | </source> | ||
=== Arguments === | === Arguments === | ||
{{param|string|text|The text that would be wrapped.}} | {{param|string|text|The text that would be wrapped.}} | ||
− | {{param|number| | + | {{param|number|wraplimit|The maximum width in pixels of each line that ''text'' is allowed before wrapping.}} |
=== Returns === | === Returns === | ||
− | {{param|number|width|The | + | {{param|number|width|The maximum width of the wrapped text.}} |
− | {{param|number|lines|The number of lines text | + | {{param|number|lines|The number of lines that the wrapped text will have.}} |
+ | |||
== See Also == | == See Also == | ||
* [[parent::Font]] | * [[parent::Font]] | ||
+ | * [[love.graphics.printf]] | ||
+ | * [[Text:setf]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
− | {{#set:Description= | + | {{#set:Description=Gets formatting information for text, given a wrap limit.}} |
== Other Languages == | == Other Languages == | ||
{{i18n|Font:getWrap}} | {{i18n|Font:getWrap}} |
Revision as of 04:43, 18 December 2015
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')
Contents
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 table 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
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info