From e654c3994480a9f17622515ccfe3e7253e0cada9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Jos=C3=A9=20Garc=C3=ADa=20Garc=C3=ADa?= Date: Fri, 23 Sep 2016 21:27:06 +0200 Subject: [PATCH] (VITA) Fix utf8 --- gfx/drivers_font/vita2d_font.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gfx/drivers_font/vita2d_font.c b/gfx/drivers_font/vita2d_font.c index c3ee301eef..3bb2b10e66 100644 --- a/gfx/drivers_font/vita2d_font.c +++ b/gfx/drivers_font/vita2d_font.c @@ -100,6 +100,11 @@ static int vita2d_font_get_message_width(void *data, const char *msg, { const char *msg_tmp = &msg[i]; unsigned code = utf8_walk(&msg_tmp); + unsigned skip = msg_tmp - &msg[i]; + + if (skip > 1) + i += skip - 1; + const struct font_glyph *glyph = font->font_driver->get_glyph(font->font_data, code); if (!glyph) /* Do something smarter here ... */ @@ -145,6 +150,11 @@ static void vita2d_font_render_line( int off_x, off_y, tex_x, tex_y, width, height; const char *msg_tmp = &msg[i]; unsigned code = utf8_walk(&msg_tmp); + unsigned skip = msg_tmp - &msg[i]; + + if (skip > 1) + i += skip - 1; + const struct font_glyph *glyph = font->font_driver->get_glyph(font->font_data, code);