Difference between revisions of "Text:addf"
(Added colored text variant) |
m |
||
(2 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
Adds additional formatted / colored text to the Text object at the specified position. | Adds additional formatted / colored text to the Text object at the specified position. | ||
+ | The word wrap limit is applied before any scaling, rotation, and other coordinate transformations. Therefore the amount of text per line stays constant given the same wrap limit, even if the scale arguments change. | ||
+ | |||
+ | {{notice|Text may appear blurry if it's rendered at non-integer pixel locations.}} | ||
== Function == | == Function == | ||
=== Synopsis === | === Synopsis === | ||
Line 34: | Line 37: | ||
{{subparam|table|color2|A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of <code>{red, green, blue, alpha}</code>.}} | {{subparam|table|color2|A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of <code>{red, green, blue, alpha}</code>.}} | ||
{{subparam|string|string2|A string of text which has a color specified by the previous color.}} | {{subparam|string|string2|A string of text which has a color specified by the previous color.}} | ||
+ | {{subparam|tables and strings|...|Additional colors and strings.}} | ||
{{param|number|wraplimit|The maximum width in pixels of the text before it gets automatically wrapped to a new line.}} | {{param|number|wraplimit|The maximum width in pixels of the text before it gets automatically wrapped to a new line.}} | ||
{{param|AlignMode|align|The alignment of the text.}} | {{param|AlignMode|align|The alignment of the text.}} |
Latest revision as of 23:22, 27 May 2019
Available since LÖVE 0.10.0 |
This function is not supported in earlier versions. |
Adds additional formatted / colored text to the Text object at the specified position.
The word wrap limit is applied before any scaling, rotation, and other coordinate transformations. Therefore the amount of text per line stays constant given the same wrap limit, even if the scale arguments change.
Text may appear blurry if it's rendered at non-integer pixel locations. |
Contents
Function
Synopsis
index = Text:addf( textstring, wraplimit, alignmode, x, y, angle, sx, sy, ox, oy, kx, ky )
Arguments
string textstring
- The text to add to the object.
number wraplimit
- The maximum width in pixels of the text before it gets automatically wrapped to a new line.
AlignMode align
- The alignment of the text.
number x
- The position of the new text (x-axis).
number y
- The position of the new text (y-axis).
number angle (0)
- Orientation (radians).
number sx (1)
- Scale factor (x-axis).
number sy (sx)
- Scale factor (y-axis).
number ox (0)
- Origin offset (x-axis).
number oy (0)
- Origin offset (y-axis).
number kx (0)
- Shearing / skew factor (x-axis).
number ky (0)
- Shearing / skew factor (y-axis).
Returns
number index
- An index number that can be used with Text:getWidth or Text:getHeight.
Function
Synopsis
index = Text:addf( coloredtext, wraplimit, alignmode, x, y, angle, sx, sy, ox, oy, kx, ky )
Arguments
table coloredtext
- A table containing colors and strings to add to the object, in the form of
{color1, string1, color2, string2, ...}
.table color1
- A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of
{red, green, blue, alpha}
. string string1
- A string of text which has a color specified by the previous color.
table color2
- A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of
{red, green, blue, alpha}
. string string2
- A string of text which has a color specified by the previous color.
tables and strings ...
- Additional colors and strings.
number wraplimit
- The maximum width in pixels of the text before it gets automatically wrapped to a new line.
AlignMode align
- The alignment of the text.
number x
- The position of the new text (x-axis).
number y
- The position of the new text (y-axis).
number angle (0)
- Orientation (radians).
number sx (1)
- Scale factor (x-axis).
number sy (sx)
- Scale factor (y-axis).
number ox (0)
- Origin offset (x-axis).
number oy (0)
- Origin offset (y-axis).
number kx (0)
- Shearing / skew factor (x-axis).
number ky (0)
- Shearing / skew factor (y-axis).
Returns
number index
- An index number that can be used with Text:getWidth or Text:getHeight.
Notes
The color set by love.graphics.setColor will be combined (multiplied) with the colors of the text, when drawing the Text object.
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