diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-08-03 05:15:18 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-08-03 05:15:18 +0200 |
commit | 0b6c868d34cdaf409a46cd41fefe8871672b080c (patch) | |
tree | 83b4f028e4b9dacf9db1470eff5e873c098860d3 | |
parent | 238ed3cf79f616cd6aeb8d14b1e66a7c36ca6def (diff) |
text get bounds return character size if string is empty
-rw-r--r-- | src/graphics/text.c | 2 |
1 files changed, 2 insertions, 0 deletions
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 }; } |