From c4f84e1969f4c856a5bf0352e99fcb73a4cf56cf Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 8 Nov 2021 16:03:02 +0100 Subject: Do not check for valid utf8 in set text, render the invalid utf8 instead. Mmap fonts instead of loading the whole font --- src/graphics/text.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/graphics/text.c') diff --git a/src/graphics/text.c b/src/graphics/text.c index 28840ce..d330dc0 100644 --- a/src/graphics/text.c +++ b/src/graphics/text.c @@ -47,13 +47,13 @@ static mgl_vec2f mgl_text_calculate_bounds(mgl_text *self) { return bounds; } -int mgl_text_init(mgl_text *self, mgl_font *font, const char *str, size_t str_size) { +void mgl_text_init(mgl_text *self, mgl_font *font, const char *str, size_t str_size) { self->font = font; self->color = (mgl_color){ 255, 255, 255, 255 }; self->position = (mgl_vec2f){ 0.0f, 0.0f }; self->text = NULL; self->text_size = 0; - return mgl_text_set_string(self, str, str_size); + mgl_text_set_string(self, str, str_size); } void mgl_text_deinit(mgl_text *self) { @@ -64,14 +64,13 @@ void mgl_text_deinit(mgl_text *self) { self->bounds = (mgl_vec2f){ 0.0f, 0.0f }; } -int mgl_text_set_string(mgl_text *self, const char *str, size_t str_size) { +void mgl_text_set_string(mgl_text *self, const char *str, size_t str_size) { self->text = str; self->text_size = str_size; if(self->text && self->text_size > 0 && self->font) self->bounds = mgl_text_calculate_bounds(self); else self->bounds = (mgl_vec2f){ 0.0f, 0.0f }; - return 0; } void mgl_text_set_font(mgl_text *self, mgl_font *font) { -- cgit v1.2.3