Merge pull request #3467 from bparker06/utf8_fix

fix rendering of utf8 glyphs
This commit is contained in:
Twinaphex 2016-08-29 17:39:42 +02:00 committed by GitHub
commit 0e1ac30843

View File

@ -216,8 +216,9 @@ static int gl_get_message_width(void *data, const char *msg,
{ {
for (i = 0; i < msg_len; i++) for (i = 0; i < msg_len; i++)
{ {
const char *msg_tmp = &msg[i];
const struct font_glyph *glyph = 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 ... */ if (!glyph) /* Do something smarter here ... */
glyph = font->font_driver->get_glyph(font->font_data, '?'); 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++) for (i = 0; i < msg_len; i++)
{ {
int off_x, off_y, tex_x, tex_y, width, height; int off_x, off_y, tex_x, tex_y, width, height;
const char *msg_tmp = &msg[i];
const struct font_glyph *glyph = 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 ... */ if (!glyph) /* Do something smarter here ... */
glyph = font->font_driver->get_glyph(font->font_data, '?'); glyph = font->font_driver->get_glyph(font->font_data, '?');