From aca31b014e7db0cddfaa3fceb2b4a98a1ad3380c Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 21 Jan 2023 14:06:25 +0100 Subject: fix: set prev codepoint in text render --- src/graphics/text.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/graphics/text.c b/src/graphics/text.c index 92c578c..0942b62 100644 --- a/src/graphics/text.c +++ b/src/graphics/text.c @@ -155,6 +155,8 @@ static bool find_character_pos_callback(size_t codepoint_index, uint32_t codepoi } else { find_character_pos_userdata->position.x += glyph->advance + mgl_font_get_kerning(find_character_pos_userdata->text->font, find_character_pos_userdata->prev_codepoint, codepoint); } + + find_character_pos_userdata->prev_codepoint = codepoint; return true; } @@ -203,6 +205,7 @@ static bool text_draw_callback(size_t codepoint_index, uint32_t codepoint, const mgl_text_draw_glyph(text_draw_userdata->context, glyph, (mgl_vec2i){ text_draw_userdata->position.x, text_draw_userdata->position.y }); text_draw_userdata->position.x += glyph->advance; } + text_draw_userdata->prev_codepoint = codepoint; return true; } -- cgit v1.2.3