From 298e9bddf5e8dedba29ebcc36cab74dee0a4ec1a Mon Sep 17 00:00:00 2001 From: kichikuou Date: Sun, 23 Feb 2025 16:35:08 +0900 Subject: [PATCH] Fix text rendering issue on the save screen of Daiteikoku This fixes the same bug that commit c4e17c6 fixed, for sprites created by ChipmunkSpriteEngine.SP_SetTextSprite. This uses text_style_width() instead of gfx_size_char() so that edge width is taken into account. --- src/hll/StoatSpriteEngine.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/hll/StoatSpriteEngine.c b/src/hll/StoatSpriteEngine.c index 4978564..7df4814 100644 --- a/src/hll/StoatSpriteEngine.c +++ b/src/hll/StoatSpriteEngine.c @@ -113,13 +113,11 @@ bool StoatSpriteEngine_SP_SetTextSprite(int sp_no, struct string *text) char s[3]; extract_sjis_char(text->text, s); - int w = text_sprite_ts.size; + int w = ceilf(text_style_width(&text_sprite_ts, s)); int h = text_sprite_ts.size; // XXX: System40.exe lies about the height of half-width characters. // E.g. a size 64 letter "H" is reported as 32 pixels tall. // Probably doesn't matter...? - if (isascii(s[0])) - w /= 2; struct sact_sprite *sp = sact_create_sprite(sp_no, w, h, 0, 0, 0, 0); sprite_get_texture(sp); // XXX: force initialization of texture gfx_render_text(&sp->texture, 0.0f, 0, s, &text_sprite_ts, false);