natiny_render_text
void natiny_render_text(
NatinyFont font,
float x, float y,
const char* text
);
Draws text with the given font on the currently bound render target using the current draw color.
Parameters
| Name | Type | Description |
|---|---|---|
font |
NatinyFont |
Font handle from natiny_font_create |
x |
float |
X position in pixels |
y |
float |
Y position in pixels |
text |
const char* |
UTF-8 text to draw |
Example
natiny_render_text(font, 20.0f, 20.0f, "Score: 100");
Notes
textis decoded as UTF-8 and glyphs are cached by the font on demand.(x, y)is the top-left of the first line; the baseline is derived from the font ascent. The current draw color tints the glyphs.starts a new line andmoves to the next tab stop, four spaces apart. Lines are stacked bynatiny_font_get_line_height.- No wrapping: use
natiny_render_text_boxfor text that has to fit a width, andnatiny_render_text_exto turn it. natiny_font_measure_textmeasures exactly what this draws.