From c4e17c672d49d370e7450fd1cc7c1fa5b49c2283 Mon Sep 17 00:00:00 2001 From: Nunuhara Cabbage Date: Thu, 1 Aug 2024 08:18:23 -0700 Subject: [PATCH] Fix text rendering issue in Daiteikoku Use gfx_size_char to calculate CharSprite width. Daiteikoku uses ascii numerals in the .ain file, but the .fnl font has full-width glyphs. --- src/hll/CharSpriteManager.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/hll/CharSpriteManager.c b/src/hll/CharSpriteManager.c index 4f77854..f37d168 100644 --- a/src/hll/CharSpriteManager.c +++ b/src/hll/CharSpriteManager.c @@ -16,6 +16,7 @@ #include #include +#include #include "system4.h" #include "system4/string.h" @@ -174,11 +175,8 @@ static void charsprite_render(struct charsprite *cs) ch[2] = 0; } - int w = cs->ts.size; + int w = ceilf(gfx_size_char(&cs->ts, ch)); int h = cs->ts.size + cs->ts.size/2; - if (isascii(ch[0])) - w /= 2; - sprite_init_color(&cs->sp, w, h, 0, 0, 0, 0); sprite_get_texture(&cs->sp); // XXX: force initialization of texture gfx_render_text(&cs->sp.texture, 0.0f, 0, ch, &cs->ts, false);