diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 16b8d4bc5..ae21e77d3 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -200,13 +200,13 @@ void HU_LoadGraphics(void) HU_LoadFontCharacters(&ntb_font, "NTFNT"); HU_LoadFontCharacters(&nto_font, "NTFNO"); - // Set kerning, space width & line spacing for each font - HU_SetFontProperties(&hu_font, 0, 4, 12); - HU_SetFontProperties(&tny_font, 0, 2, 12); - HU_SetFontProperties(&cred_font, 0, 16, 16); - HU_SetFontProperties(<_font, 0, 16, 20); - HU_SetFontProperties(&ntb_font, 2, 4, 21); - HU_SetFontProperties(&nto_font, 0, 4, 21); + // For each font, set kerning, space width, character width and line spacing + HU_SetFontProperties(&hu_font, 0, 4, 8, 12); + HU_SetFontProperties(&tny_font, 0, 2, 4, 12); + HU_SetFontProperties(&cred_font, 0, 16, 16, 16); + HU_SetFontProperties(<_font, 0, 16, 20, 20); + HU_SetFontProperties(&ntb_font, 2, 4, 20, 21); + HU_SetFontProperties(&nto_font, 0, 4, 20, 21); //cache numbers too! for (i = 0; i < 10; i++) @@ -279,10 +279,11 @@ void HU_LoadFontCharacters(fontdef_t *font, const char *prefix) } } -void HU_SetFontProperties(fontdef_t *font, INT32 kerning, UINT32 spacewidth, UINT32 linespacing) +void HU_SetFontProperties(fontdef_t *font, INT32 kerning, UINT32 spacewidth, UINT32 charwidth, UINT32 linespacing) { font->kerning = kerning; font->spacewidth = spacewidth; + font->charwidth = charwidth; font->linespacing = linespacing; } diff --git a/src/hu_stuff.h b/src/hu_stuff.h index 94bc3e95e..393a66032 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -35,6 +35,7 @@ typedef struct patch_t *chars[FONTSIZE]; INT32 kerning; UINT32 spacewidth; + UINT32 charwidth; UINT32 linespacing; } fontdef_t; @@ -94,7 +95,7 @@ void HU_Init(void); void HU_LoadGraphics(void); void HU_LoadFontCharacters(fontdef_t *font, const char *prefix); -void HU_SetFontProperties(fontdef_t *font, INT32 kerning, UINT32 spacewidth, UINT32 linespacing); +void HU_SetFontProperties(fontdef_t *font, INT32 kerning, UINT32 spacewidth, UINT32 charwidth, UINT32 linespacing); // reset heads up when consoleplayer respawns. void HU_Start(void); diff --git a/src/v_video.c b/src/v_video.c index bff407dc3..b299784d3 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -1961,10 +1961,10 @@ char *V_FontWordWrap(INT32 x, INT32 w, INT32 option, fixed_t scale, const char * switch (option & V_SPACINGMASK) { case V_MONOSPACE: - spacewidth = font.spacewidth*2; + spacewidth = font.charwidth; /* FALLTHRU */ case V_OLDSPACING: - charwidth = font.spacewidth*2; + charwidth = font.charwidth; break; case V_6WIDTHSPACE: spacewidth = 6; @@ -2057,10 +2057,10 @@ void V_DrawFontStringAtFixed(fixed_t x, fixed_t y, INT32 option, fixed_t pscale, switch (option & V_SPACINGMASK) // TODO: 2.3: drop support for these crusty flags { case V_MONOSPACE: - spacewidth = font.spacewidth*2; + spacewidth = font.charwidth; /* FALLTHRU */ case V_OLDSPACING: - charwidth = font.spacewidth*2; + charwidth = font.charwidth; break; case V_6WIDTHSPACE: spacewidth = 6; @@ -2432,10 +2432,10 @@ INT32 V_FontStringWidth(const char *string, INT32 option, fontdef_t font) switch (option & V_SPACINGMASK) { case V_MONOSPACE: - spacewidth = font.spacewidth*2; + spacewidth = font.charwidth; /* FALLTHRU */ case V_OLDSPACING: - charwidth = font.spacewidth*2; + charwidth = font.charwidth; break; case V_6WIDTHSPACE: spacewidth = 6;