Skip to content

Commit

Permalink
Center menu titles (#1839)
Browse files Browse the repository at this point in the history
Unlike `MN_StringWidth`, `MN_GetPixelWidth` considers font kerning.
  • Loading branch information
ceski-1 authored Aug 15, 2024
1 parent 8507a60 commit 5c4ef64
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/mn_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 5c4ef64

Please sign in to comment.