natiny_render_text_ex
void natiny_render_text_ex(NatinyFont font, float x, float y,
const char* text, float origin_x,
float origin_y, float rotation);
Draws an unwrapped UTF-8 text block with a local origin and rotation.
Parameters
| Name | Type | Description |
|---|---|---|
font |
NatinyFont |
Font handle from natiny_font_create |
x, y |
float |
Position of the local origin on the current target, in drawing units |
text |
const char* |
Null-terminated UTF-8 text to draw |
origin_x |
float |
Horizontal origin offset from the block's left edge, in drawing units |
origin_y |
float |
Vertical origin offset from the block's top edge, in drawing units |
rotation |
float |
Clockwise rotation around (x, y), in degrees |
Example
float width = 0.0f, height = 0.0f;
natiny_font_measure_text(font, "SPIN", &width, &height);
natiny_render_text_ex(font, 400.0f, 300.0f, "SPIN",
width * 0.5f, height * 0.5f, angle);
Notes
(origin_x, origin_y)selects the point in the unrotated text block placed at(x, y). The block rotates around that target position.- Passing
0.0ffor all transform arguments is equivalent tonatiny_render_text. - Rotated glyphs are not snapped to the target's pixel grid. At
0.0fdegrees, normal text snapping is preserved. \nstarts a new line; all lines rotate together as one block. This function does not perform word wrapping.- Glyphs use the color set by
natiny_render_set_color. - Invalid font handles and
NULLtext are ignored.