From 9bbf19152314b5e3d784e29c92f20b2f8c8662e4 Mon Sep 17 00:00:00 2001 From: valadaa48 Date: Tue, 14 Jul 2020 21:41:41 -0400 Subject: [PATCH] oga_gfx: fix last character from being chopped in on-screen messages --- gfx/drivers/oga_gfx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gfx/drivers/oga_gfx.c b/gfx/drivers/oga_gfx.c index 45c89cdad9..44955adc52 100644 --- a/gfx/drivers/oga_gfx.c +++ b/gfx/drivers/oga_gfx.c @@ -190,7 +190,7 @@ static void render_msg(oga_video_t* vid, { const struct font_atlas* atlas = vid->font_driver->get_atlas(vid->font); int msg_width = get_message_width(vid, msg); - int dest_x = MAX(0, width - get_message_width(vid, msg)); + int dest_x = MAX(0, width - msg_width); int dest_stride = go2_surface_stride_get(surface); const char *c = msg; @@ -199,7 +199,7 @@ static void render_msg(oga_video_t* vid, const struct font_glyph* g = vid->font_driver->get_glyph(vid->font, *c); if (!g) continue; - if (dest_x + g->advance_x >= width) + if (dest_x >= width) break; const uint8_t* source = atlas->buffer + g->atlas_offset_y * atlas->width + g->atlas_offset_x;