#include <lua/gfx.lh>
- gcx:text(x, y, text [, mode])
- gcx:text(x, y, w, h, text [, mode])
- gcx:text(rect, text [, mode])
The first form draws text at position x, y using the stored font and colors. It supports three alignment modes:
| Mode | Symbolic | x specifies |
|---|---|---|
| "left" | ALIGN_LEFT | Left edge of text |
| "right" | ALIGN_RIGHT | Right edge of text |
| "center" | ALIGN_CENTER | Horizontal center of text |
The y coordinate specifies the position of the baseline of the font. The baseline is at the lower edge of the upper case letter A. If there are newlines in the text string, the y coordinate is advanced by the font's height and the alignment is calculated anew for the next line.
Draws text into the specified rectangle using the stored font and colors.
mode specifies the alignment within the specified rectangle, default is top/left.
| Mode | Symbolic |
|---|---|
| "tl" or "topleft" | ALIGN_TOP | ALIGN_LEFT |
| "tr" or "topright" | ALIGN_TOP | ALIGN_RIGHT |
| "bl" or "bottomleft" | ALIGN_BOTTOM | ALIGN_LEFT |
| "br" or "bottomright" | ALIGN_BOTTOM | ALIGN_RIGHT |
| "tc" or "topcenter" | ALIGN_TOP | ALIGN_CENTER |
| "bc" or "bottomcenter" | ALIGN_BOTTOM | ALIGN_CENTER |
| "cl" or "centerleft" | ALIGN_VCENTER | ALIGN_LEFT |
| "cr" or "centerright" | ALIGN_VCENTER | ALIGN_RIGHT |
| "cc" or "middle" | ALIGN_VCENTER | ALIGN_CENTER |