RenderingContext:draw_string()
RenderingContext:draw_string(param_table)
RenderingContext:draw_string(string[, x[, y[, width[, height[, horizontal_alignment[, vertical_alignment]]]]]])
This method renders text using the font and brush set in the rendering context.
Parameters
Parameter | Type | Description |
---|---|---|
param_table | table | This parameter is in associative array table format, meaning it's specified by keys rather than parameter positions. See the Parameters Table section. |
string | string | String to be rendered. |
x | number | The size of the bounding box in which the text is drawn. It specifies the X-coordinate of the top-left corner of the bounding box. The default value is 0. |
y | number | The size of the bounding box in which the text is drawn. It specifies the Y-coordinate of the top-left corner of the bounding box. The default value is 0. |
width | number | The width of the bounding box in which the text is drawn. The default value is positive infinity. |
height | number | The height of the bounding box in which the text is drawn. The default value is positive infinity. |
horizontal_alignment | string | Specifies how to horizontally align the rendering result within the bounding box specified by the x , y , width , and height parameters.It specifies either of left , center , or right .The default is left . |
vertical_alignment | string | Specifies how to vertically align the rendering result within the bounding box specified by the x , y , width , and height parameters.It specifies either of top , center , or bottom .The default is top . |
Parameters Table
Key | Type | Description |
---|---|---|
string | string | String to be rendered. |
x | number | The size of the bounding box in which the text is drawn. It specifies the X-coordinate of the top-left corner of the bounding box. The default value is 0. |
y | number | The size of the bounding box in which the text is drawn. It specifies the Y-coordinate of the top-left corner of the bounding box. The default value is 0. |
width | number | The width of the bounding box in which the text is drawn. The default value is positive infinity. |
height | number | The height of the bounding box in which the text is drawn. The default value is positive infinity. |
horizontal_alignment | string | Specifies how to horizontally align the rendering result within the bounding box specified by the x , y , width , and height parameters.It specifies either of left , center , or right .The default is left . |
vertical_alignment | string | Specifies how to vertically align the rendering result within the bounding box specified by the x , y , width , and height parameters.It specifies either of top , center , or bottom .The default is top . |
Note
If the font set in the rendering context is a BitmapFont
object, text wrapping and alignment changes within the bounding box are not possible.
The following parameters are ignored for BitmapFont
objects.
width
height
horizontal_alignment
vertical_alignment
Return Values
This method doesn't return any value.