diff options
Diffstat (limited to 'include/mgl/graphics')
-rw-r--r-- | include/mgl/graphics/text.h | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/include/mgl/graphics/text.h b/include/mgl/graphics/text.h index f832605..aca0650 100644 --- a/include/mgl/graphics/text.h +++ b/include/mgl/graphics/text.h @@ -16,33 +16,27 @@ typedef struct mgl_font mgl_font; typedef struct mgl_context mgl_context; typedef struct { - /* Optional */ - void (*before_syntax_highlight)(void *userdata); - /* Return true if the text format should be changed. Optional */ - bool (*syntax_highlight)(void *userdata, const char *str, size_t size, mgl_color *color); - void *userdata; -} mgl_text_options; - -typedef struct { mgl_font *font; /* nullable */ const char *text; /* nullable */ size_t text_size; mgl_color color; mgl_vec2f position; mgl_vec2f bounds; - mgl_text_options options; } mgl_text; /* Note: keeps a reference to |text|. |text| needs to be valid as long as |self| is used. |font| and |text| may be NULL. - |load_options| can be NULL, in which case the default options are used. */ -int mgl_text_init(mgl_text *self, mgl_font *font, const char *str, size_t str_size, mgl_text_options *options); +int mgl_text_init(mgl_text *self, mgl_font *font, const char *str, size_t str_size); void mgl_text_deinit(mgl_text *self); -/* Note: keeps a reference to |text|. |text| needs to be valid as long as |self| is used. |text| may be NULL. */ -void mgl_text_set_string(mgl_text *self, const char *str, size_t str_size); +/* + Note: keeps a reference to |text|. |text| needs to be valid as long as |self| is used. + |text| may be NULL. + |str| will be checked if its a valid utf8 string. +*/ +int mgl_text_set_string(mgl_text *self, const char *str, size_t str_size); /* |font| may be NULL */ void mgl_text_set_font(mgl_text *self, mgl_font *font); void mgl_text_set_position(mgl_text *self, mgl_vec2f position); |