draw_text
Render text with a chosen font and paint it onto a sprite layer, with options for outline, shadow, color, spacing, and antialiasing.
Instructions
Render text with a font and paint it onto a layer.
The text's bounding box is the smallest box around every painted pixel (glyphs, outline and shadow); anchor picks which of its pixels is placed at (x, y). For an even width or height the centre pixel is the one left of or above the middle. measure_text gives the box size. Without antialias every pixel gets exactly color (or outline/shadow); with it, edge pixels are partly transparent: blend=false stores them as they are, blend=true mixes them over the layer. Indexed sprites take the nearest palette colour (partly transparent edges become opaque there, so keep antialias off). Pixels off the canvas are skipped and counted in skipped_outside. Text is at most 2000 characters and 2048x2048 px. Colour emoji are not supported; characters the font lacks show its fallback glyph.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"path": "<path>",
"text": "<text>",
"x": "<x>",
"y": "<y>",
"color": "<color>"
},
"name": "draw_text"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | Canvas x of the anchor point | |
| y | Yes | Canvas y of the anchor point | |
| bold | No | Thicken the glyphs by 1 px to the right | |
| font | No | Font name from list_fonts (family, 'Family Style' or file name, any case) or an absolute path to a .ttf/.otf/.ttc file; empty = the built-in font | |
| path | Yes | Sprite file. Relative paths resolve against the server root. | |
| size | No | Font size in pixels (FreeType pixel size) | |
| text | Yes | Text, at most 2000 characters; '\n' starts a new line | |
| blend | No | false: pixels get exactly this colour (transparent erases, except on a background layer, which ignores alpha); true: the colour is alpha-blended over what is there | |
| color | Yes | '#RRGGBB', '#RRGGBBAA' or 'transparent' | |
| frame | No | 1-based frame number | |
| layer | No | Layer name or 'group/child' path; empty = the bottom-most normal layer | |
| anchor | No | Which pixel of the text's bounding box lands on (x, y) | top_left |
| shadow | No | Colour of a drop shadow | |
| outline | No | Colour of a ring around the glyphs | |
| antialias | No | Keep smooth, partly transparent glyph edges; false = crisp pixels | |
| shadow_dx | No | Shadow offset to the right | |
| shadow_dy | No | Shadow offset downwards | |
| create_cel | No | Add an empty cel when the layer has none in that frame | |
| line_spacing | No | Extra px between lines | |
| outline_width | No | Outline thickness in pixels | |
| letter_spacing | No | Extra px between characters |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||