Image & Canvas
canvasDrawText
$canvasDrawText
Draws text on the canvas at the specified position with configurable font size, color, and alignment
Syntax
$canvasDrawText[text;x;y;fontSize;color;textAlign?;maxWidth?;container?]
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| text | string | check_circle Required | — | The text string to render. Supports template variables via ((varName)). |
| x | integer | check_circle Required | — | Horizontal position |
| y | integer | check_circle Required | — | Vertical position (baseline) |
| fontSize | integer | check_circle Required | — | Font size in pixels. Auto-selects from arial14 (<20px), arial24 (20–39px), or arial48 (≥40px). |
| color | color | check_circle Required | — | Text color (hex or named) |
| textAlign | string | Optional | — |
Horizontal text alignment (requires maxWidth)
left
center
right
|
| maxWidth | integer | Optional | — | Constrains the text area width for alignment. Text outside this width is not clipped. |
| container | string | Optional | — | Container name for relative positioning |
Return Value
canvas
Modifies the canvas in-place by drawing the text at the specified position.
Text outside the canvas boundaries is clipped and will not appear in the output. The font is selected automatically based on font size: arial14 for sizes under 20px, arial24 for 20–39px, and arial48 for 40px and above. Multi-line text is not supported — each call draws a single line. Use template variable syntax ((varName)) to embed dynamic values in the text string.
Examples
Basic text
$canvasCreate[label;300;100;white]
$canvasDrawText[Hello World!;20;60;32;black]
$attachImage[label]
Centered title
$canvasCreate[header;600;80;#1a1a2e]
$canvasDrawText[Monthly Report;0;50;28;white;center;600]
$attachImage[header]
Right-aligned value
$canvasDrawText[$getUserVar[score];0;40;20;gold;right;200]