aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-01-21 14:06:25 +0100
committerdec05eba <dec05eba@protonmail.com>2023-01-21 14:06:25 +0100
commitaca31b014e7db0cddfaa3fceb2b4a98a1ad3380c (patch)
tree4a01473980f1de96e41326951bc04c71174809fd
parentc6d09be0a56c7b96be48f074901a53d7f76c25cc (diff)
fix: set prev codepoint in text render
-rw-r--r--src/graphics/text.c3
1 files changed, 3 insertions, 0 deletions
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;
}