draw_text
Draws text onto an Aseprite sprite by rasterizing glyphs externally and compositing them, since the Lua API lacks native text drawing.
Instructions
Draw text onto a sprite.
Glyphs are rasterised outside Aseprite and composited in, because the Lua API has no text drawing of its own.
Args: filename: Aseprite file to modify text: String to draw x: X coordinate of the anchor point y: Y coordinate of the anchor point font: Font name from list_text_fonts, or a path to a .ttf/.otf or a bitmap font directory size: Pixel size for TrueType fonts; integer scale factor for bitmap fonts (default 1) color: Text colour, #RRGGBB or #RRGGBBAA (default white) layer_name: Layer to draw on; the active/first layer if omitted frame_index: Frame index starting at 1 (default 1) anchor: Which point of the text (x, y) refers to - one of topleft, top, topright, left, center, right, bottomleft, bottom, bottomright, baselineleft, baseline, baselineright (default topleft) letter_spacing: Extra pixels between glyphs (default 0) bold: Faux-bold passes; each grows strokes by 1px (default 0) outline_color: If set, draw a 1px outline in this colour outline_width: Outline thickness in pixels (default 1) outline_diagonal: Include diagonal neighbours in the outline, giving a rounded corner; False gives a boxier 4-way outline (default True) shadow_color: If set, draw a drop shadow in this colour shadow_dx: Shadow X offset (default 1) shadow_dy: Shadow Y offset (default 1) antialias: Keep greyscale edges instead of hard pixels (default False) create_if_missing: Create the layer/cel if absent (default True)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | ||
| y | Yes | ||
| bold | No | ||
| font | Yes | ||
| size | No | ||
| text | Yes | ||
| color | No | #FFFFFF | |
| anchor | No | topleft | |
| filename | Yes | ||
| antialias | No | ||
| shadow_dx | No | ||
| shadow_dy | No | ||
| layer_name | No | ||
| frame_index | No | ||
| shadow_color | No | ||
| outline_color | No | ||
| outline_width | No | ||
| letter_spacing | No | ||
| outline_diagonal | No | ||
| create_if_missing | No |