From 55d0ece0a9072ca409bdf6ff2f3b6d0b268e2952 Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Mon, 23 Nov 2020 18:29:58 -0500 Subject: unicode text rendering working --- text.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'text.h') diff --git a/text.h b/text.h index c855ec9..ad18ef3 100644 --- a/text.h +++ b/text.h @@ -1,11 +1,33 @@ #ifndef TEXT_H_ #define TEXT_H_ +#include + +// A text-rendering interface. +// You can either use the simple API (text_render) +// or the character-by-character API (text_chars_begin, text_chars_end, text_render_char) + + typedef struct Font Font; -char const *text_get_err(void); +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); +// Clear the current error. +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); +// 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. extern void text_get_size(Font *font, char const *text, float *width, float *height); +// Begin writing characters. +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); +// Free memory used by font. +extern void text_font_free(Font *font); #endif -- cgit v1.2.3