diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-11-25 11:24:14 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-11-25 11:24:14 -0500 |
commit | c2f91a659c126d1fd5ee951bdf58540d9d39fd47 (patch) | |
tree | b63cbf31f19ed2ed01eaf7cf7455033952679546 /text.h | |
parent | 4e51199f1103d2d9daa563b63d0e8f22c36fbe8a (diff) |
rendering a text buffer
Diffstat (limited to 'text.h')
-rw-r--r-- | text.h | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -10,6 +10,12 @@ typedef struct Font Font; +typedef struct { + float x, y; + // points at which the text should be cut off in the x and y directions + float edge_right, edge_bottom; +} TextRenderState; + extern bool text_has_err(void); // Get the current error. Errors will NOT be overwritten with newer errors. extern char const *text_get_err(void); @@ -17,6 +23,8 @@ extern char const *text_get_err(void); extern void text_clear_err(void); // Load a TTF font found in ttf_filename with the given font size (character pixel height) extern Font *text_font_load(char const *ttf_filename, float font_size); +// Height of a character of this font in pixels. +extern float text_font_char_height(Font *font); // Render some UTF-8 text to the screen (simple interface). extern void text_render(Font *font, char const *text, float x, float y); // Get the dimensions of some text. @@ -26,7 +34,7 @@ extern void text_chars_begin(Font *font); // Finish writing characters. extern void text_chars_end(Font *font); // Render a single character. -extern void text_render_char(Font *font, char32_t c, float *x, float *y); +extern void text_render_char(Font *font, char32_t c, TextRenderState *state); // Free memory used by font. extern void text_font_free(Font *font); |