diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-11-12 20:28:12 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-11-12 20:28:12 +0100 |
commit | 3f69f6c63c49ba74b8fcd8357b9b7d0498486f95 (patch) | |
tree | fd263fd4a95ea338749f0f6f04bb5320db5891fa | |
parent | 575baa8689ab4e39d268276260d0f5b53dc07e4a (diff) |
Fix multiline text height
-rw-r--r-- | src/graphics/text.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/graphics/text.c b/src/graphics/text.c index e84e4b1..e872360 100644 --- a/src/graphics/text.c +++ b/src/graphics/text.c @@ -67,8 +67,7 @@ static void mgl_text_for_each_codepoint(const mgl_text *self, codepoint_loop_cal if(((glyph_offset.x + kerning + glyph_width > self->max_width) && self->max_width > 0.001f) || codepoint == '\n') { glyph_offset.x = 0.0f; - if(codepoint != '\n') - glyph_offset.y += self->font->character_size; + glyph_offset.y += self->font->character_size; prev_codepoint = 0; if(rows == self->max_rows) @@ -82,8 +81,8 @@ static void mgl_text_for_each_codepoint(const mgl_text *self, codepoint_loop_cal return; glyph_offset.x += glyph_width; - if(codepoint == '\n') - glyph_offset.y += self->font->character_size; + //if(codepoint == '\n') + // glyph_offset.y += self->font->character_size; prev_codepoint = codepoint; @@ -100,7 +99,7 @@ typedef struct { static bool calculate_bounds_callback(codepoint_loop_callback_data callback_data, void *userdata) { CalculateBoundsUserdata *calculate_bounds_userdata = userdata; calculate_bounds_userdata->bounds.x = max_float(calculate_bounds_userdata->bounds.x, callback_data.glyph_offset.x + callback_data.glyph_width); - calculate_bounds_userdata->bounds.y = max_float(calculate_bounds_userdata->bounds.y, callback_data.glyph_offset.y); + calculate_bounds_userdata->bounds.y = max_float(calculate_bounds_userdata->bounds.y, callback_data.glyph_offset.y + callback_data.glyph->size.y); return true; } |