From 5c4ef64c6619285756082df7b933ebdaccf537f0 Mon Sep 17 00:00:00 2001 From: ceski <56656010+ceski-1@users.noreply.github.com> Date: Wed, 14 Aug 2024 20:25:27 -0700 Subject: [PATCH] Center menu titles (#1839) Unlike `MN_StringWidth`, `MN_GetPixelWidth` considers font kerning. --- src/mn_setup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mn_setup.c b/src/mn_setup.c index c9a5dd297..4098ee233 100644 --- a/src/mn_setup.c +++ b/src/mn_setup.c @@ -4326,12 +4326,12 @@ void MN_DrawTitle(int x, int y, const char *patch, const char *alttext) { // patch doesn't exist, draw some text in place of it if (!MN_DrawFon2String( - SCREENWIDTH / 2 - MN_GetFon2PixelWidth(alttext) / 2, + (SCREENWIDTH - MN_GetFon2PixelWidth(alttext)) / 2, y, NULL, alttext)) { M_snprintf(menu_buffer, sizeof(menu_buffer), "%s", alttext); DrawMenuString( - SCREENWIDTH / 2 - MN_StringWidth(alttext) / 2, + (SCREENWIDTH - MN_GetPixelWidth(alttext)) / 2, y + 8 - MN_StringHeight(alttext) / 2, // assumes patch height 16 CR_TITLE); }