From 96c96dca3bb3d94c3998a096e8faca1dc1b1b99f Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Mon, 29 Aug 2016 11:02:28 -0400 Subject: [PATCH] fix rendering of utf8 glyphs --- gfx/drivers_font/gl_raster_font.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gfx/drivers_font/gl_raster_font.c b/gfx/drivers_font/gl_raster_font.c index 594277de37..0c1b755834 100644 --- a/gfx/drivers_font/gl_raster_font.c +++ b/gfx/drivers_font/gl_raster_font.c @@ -216,8 +216,9 @@ static int gl_get_message_width(void *data, const char *msg, { for (i = 0; i < msg_len; i++) { + const char *msg_tmp = &msg[i]; const struct font_glyph *glyph = - font->font_driver->get_glyph(font->font_data, msg[i]); + font->font_driver->get_glyph(font->font_data, utf8_walk(&msg_tmp)); if (!glyph) /* Do something smarter here ... */ glyph = font->font_driver->get_glyph(font->font_data, '?'); @@ -298,8 +299,10 @@ static void gl_raster_font_render_line( for (i = 0; i < msg_len; i++) { int off_x, off_y, tex_x, tex_y, width, height; + const char *msg_tmp = &msg[i]; + const struct font_glyph *glyph = - font->font_driver->get_glyph(font->font_data, msg[i]); + font->font_driver->get_glyph(font->font_data, utf8_walk(&msg_tmp)); if (!glyph) /* Do something smarter here ... */ glyph = font->font_driver->get_glyph(font->font_data, '?');