Skip to main content

RenderingContext:draw_number()

RenderingContext:draw_number(param_table)
RenderingContext:draw_number(value[, x[, y[, width[, height[, horizontal_alignment[, vertical_alignment]]]]]])

This method renders a formated string of a numeric value using the font and brush set in the rendering context.

Parameters

ParameterTypeDescription
param_tabletableThis parameter is in associative array table format, meaning it's specified by keys rather than parameter positions. See the Parameters Table section.
valuenumberNumeric value to be rendered.
xnumberThe 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.
ynumberThe 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.
widthnumberThe width of the bounding box in which the text is drawn.
The default value is positive infinity.
heightnumberThe height of the bounding box in which the text is drawn.
The default value is positive infinity.
horizontal_alignmentstringSpecifies 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_alignmentstringSpecifies 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

KeyTypeDescription
valuenumberNumeric value to be rendered.
xnumberThe 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.
ynumberThe 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.
widthnumberThe width of the bounding box in which the text is drawn.
The default value is positive infinity.
heightnumberThe height of the bounding box in which the text is drawn.
The default value is positive infinity.
horizontal_alignmentstringSpecifies 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_alignmentstringSpecifies 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.
precisionnumberThe overall precision, i.e., number of digits including both the integer and fractional parts.
If this parameter is omitted, there is no constraint on precision.
fraction_precisionnumberPrecision of the fractional part.
If this parameter is omitted, there is no constraint on the precision of the fractional part.
leading_zerobooleanSpecification of whether to pad the leading zeros if the number of digits is less than the specified precision.
If true is specified for this parameter, leading zeros will be padded.
The default is false.
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.

See Also