Type Function Library display.* Return value TextObject Revision 2017.3060 Keywords embossed text, text See also Using Custom Fonts (guide) Display Objects (guide) display.newText() object:setEmbossColor()
Creates an embossed text object. The local origin is at the center of the text and the anchor point is initialized to this local origin.
Text is wrapped either at newlines or by specifying a width
and height
when the object is created.
By default, the text color is white ( 1, 1, 1 )
display.newEmbossedText( options )
This function takes a single argument, options
, which is a table that accepts the following parameters:
GroupObject. Display group in which to insert the text object.
String. The text to display. Similarly, to change the displayed text for a text object after it has been created, set the object.text property.
Numbers. Coordinates for the object's x and y center point.
Numbers. If supplied, text will be wrapped at width
and cropped at height
. Set height
to 0
and the text box height will adjust to the amount of text, but never exceed the maximum texture height for the device.
String, Userdata, or Constant. This can be one of the following:
main.lua
).Number. The size of the text in Corona content points. The system's default font size will be used if this parameter is omitted or if it's set to nil
or 0
.
To change the font size of a text object after it has been created, set the object.size property, not object.fontSize
.
String. This specifies the alignment of the text when the width is known, meaning it either contains a newline or the width
parameter is supplied. Default value is "left"
. Valid values are "left"
, "center"
, or "right"
.
display.newEmbossedText( [parent,] text, x, y, [width, height,] font, fontSize )
GroupObject. The display group to insert the embossed text object into.
String. The text to display. Similarly, to change the displayed text for a text object after it has been created, set the object.text property.
Numbers. Coordinates for the object's x and y center point.
Numbers. If supplied, text will be wrapped at width
and cropped at height
. Set height
to 0
and the text box height will adjust to the amount of text, but never exceed the maximum texture height for the device.
String, Userdata, or Constant. This can be one of the following:
main.lua
).Number. The size of the text in Corona content points. The system's default font size will be used if this parameter is omitted or if it's set to nil
or 0
.
To change the font size of a text object after it has been created, set the object.size property, not object.fontSize
.
The newEmbossedText
object uses a mask when the object is created. There is a nested masking limit of 3, so care must be taken when inserting masked objects into other masked objects which act as containers, including display.newContainer, widget.newScrollView, widget.newTableView, or a masked display group. Other display objects that utilize masks include display.newText and any other masked display object. If you exceed the mask nesting limit, the text may appear as a solid white block. For example, a text object (one mask) inside a container (one mask) inside yet another container (one mask) would reach but not exceed the limit of 3 nested masks.
newEmbossedText
support both text.text = string
as well as text:setText( string )
methods to change the text of embossed text. The latter function returns a display group rather than a vector text object, with additional methods for setting text (text:setText()
) and changing the text color (text:setFillColor()
). Use text.text
to retrieve the text string.
newEmbossedText
supports both text.size = number
as well as text:setSize( number )
to change the size of embossed text. Use text.size
to retrieve the text size.
Use text:setEmbossColor( colorTable )
method to change the emboss color of the text.
local myText = display.newEmbossedText( "hello", 200, 100, native.systemFont, 40 ) myText:setFillColor( 0.5 ) myText:setText( "Hello World!" ) local color = { highlight = { r=1, g=1, b=1 }, shadow = { r=0.3, g=0.3, b=0.3 } } myText:setEmbossColor( color )