From 0b6c868d34cdaf409a46cd41fefe8871672b080c Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 3 Aug 2024 05:15:18 +0200 Subject: text get bounds return character size if string is empty --- src/graphics/text.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/graphics') diff --git a/src/graphics/text.c b/src/graphics/text.c index 76ac128..372def2 100644 --- a/src/graphics/text.c +++ b/src/graphics/text.c @@ -129,6 +129,8 @@ mgl_vec2f mgl_text_get_bounds(mgl_text *self) { self->bounds_dirty = false; if(self->text && self->text_size > 0 && self->font) self->bounds = mgl_text_calculate_bounds(self); + else if(self->font) + self->bounds = (mgl_vec2f){ 0.0f, (float)self->font->character_size }; else self->bounds = (mgl_vec2f){ 0.0f, 0.0f }; } -- cgit v1.2.3