draw_text
Place single-color text on a sprite layer at a specified position, with options for font, scale, and multi-line support.
Instructions
Draw text onto a layer at (x, y) in a single colour.
Args:
text: The string (supports "\n" for multiple lines).
x, y: Top-left position of the text.
color: Text colour.
scale: Integer pixel-scaling of the rendered glyphs (default 1).
font_path: Optional path to a .ttf/.otf font. If omitted, a built-in
bitmap font is used (best for tiny pixel text).
font_size: Point size when a TrueType font_path is given.
spacing: Extra pixels between lines.
threshold: 0-255 cutoff; pixels brighter than this are drawn (lower =
heavier text). Keeps glyphs crisp (no anti-aliasing artefacts).
Returns the standard draw result plus the rendered text's pixel size.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | ||
| y | Yes | ||
| text | Yes | ||
| color | Yes | ||
| frame | No | ||
| layer | No | ||
| scale | No | ||
| spacing | No | ||
| filename | Yes | ||
| font_path | No | ||
| font_size | No | ||
| threshold | No |