From 908fb8b026f063739a73eb2ea8cd204fd37f4f06 Mon Sep 17 00:00:00 2001
From: spherallic <spherallic@gmail.com>
Date: Thu, 3 Feb 2022 13:41:24 +0100
Subject: [PATCH] Add fontdef_t struct, move the width and height variables
 there.

---
 src/hu_stuff.c | 31 +++++++++++++---------
 src/hu_stuff.h | 10 ++++++-
 src/m_menu.c   |  4 +--
 src/st_stuff.c |  4 +--
 src/v_video.c  | 72 +++++++++++++++++++++++++-------------------------
 src/v_video.h  | 70 ++++++++++++++++++++++++------------------------
 6 files changed, 103 insertions(+), 88 deletions(-)

diff --git a/src/hu_stuff.c b/src/hu_stuff.c
index cf7118fbe0..072bfaa475 100644
--- a/src/hu_stuff.c
+++ b/src/hu_stuff.c
@@ -60,8 +60,9 @@
 //-------------------------------------------
 //              heads up font
 //-------------------------------------------
-patch_t *hu_font[HU_FONTSIZE];
-patch_t *tny_font[HU_FONTSIZE];
+fontdef_t hu_font;
+fontdef_t tny_font;
+
 patch_t *tallnum[10]; // 0-9
 patch_t *nightsnum[10]; // 0-9
 
@@ -193,18 +194,24 @@ void HU_LoadGraphics(void)
 		// cache the heads-up font for entire game execution
 		sprintf(buffer, "STCFN%.3d", j);
 		if (W_CheckNumForName(buffer) == LUMPERROR)
-			hu_font[i] = NULL;
+			hu_font.chars[i] = NULL;
 		else
-			hu_font[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
+			hu_font.chars[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
 
 		// tiny version of the heads-up font
 		sprintf(buffer, "TNYFN%.3d", j);
 		if (W_CheckNumForName(buffer) == LUMPERROR)
-			tny_font[i] = NULL;
+			tny_font.chars[i] = NULL;
 		else
-			tny_font[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
+			tny_font.chars[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
 	}
 
+	hu_font.width = 8;
+	hu_font.height = 12;
+
+	tny_font.width = 5;
+	tny_font.height = 12;
+
 	j = LT_FONTSTART;
 	for (i = 0; i < LT_FONTSIZE; i++)
 	{
@@ -864,7 +871,7 @@ static inline boolean HU_keyInChatString(char *s, char ch)
 {
 	size_t l;
 
-	if ((ch >= HU_FONTSTART && ch <= HU_FONTEND && hu_font[ch-HU_FONTSTART])
+	if ((ch >= HU_FONTSTART && ch <= HU_FONTEND && hu_font.chars[ch-HU_FONTSTART])
 	  || ch == ' ') // Allow spaces, of course
 	{
 		l = strlen(s);
@@ -1314,7 +1321,7 @@ static char *CHAT_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
 			c = toupper(c);
 		c -= HU_FONTSTART;
 
-		if (c < 0 || c >= HU_FONTSIZE || !hu_font[c])
+		if (c < 0 || c >= HU_FONTSIZE || !hu_font.chars[c])
 		{
 			chw = spacewidth;
 			lastusablespace = i;
@@ -1796,8 +1803,8 @@ static void HU_DrawChat_Old(void)
 	size_t i = 0;
 	const char *ntalk = "Say: ", *ttalk = "Say-Team: ";
 	const char *talk = ntalk;
-	INT32 charwidth = 8 * con_scalefactor; //(hu_font['A'-HU_FONTSTART]->width) * con_scalefactor;
-	INT32 charheight = 8 * con_scalefactor; //(hu_font['A'-HU_FONTSTART]->height) * con_scalefactor;
+	INT32 charwidth = 8 * con_scalefactor; //(hu_font.chars['A'-HU_FONTSTART]->width) * con_scalefactor;
+	INT32 charheight = 8 * con_scalefactor; //(hu_font.chars['A'-HU_FONTSTART]->height) * con_scalefactor;
 	if (teamtalk)
 	{
 		talk = ttalk;
@@ -1818,7 +1825,7 @@ static void HU_DrawChat_Old(void)
 		}
 		else
 		{
-			//charwidth = (hu_font[talk[i]-HU_FONTSTART]->width) * con_scalefactor;
+			//charwidth = (hu_font.chars[talk[i]-HU_FONTSTART]->width) * con_scalefactor;
 			V_DrawCharacter(HU_INPUTX + c, y, talk[i++] | cv_constextsize.value | V_NOSCALESTART, true);
 		}
 		c += charwidth;
@@ -1846,7 +1853,7 @@ static void HU_DrawChat_Old(void)
 		}
 		else
 		{
-			//charwidth = (hu_font[w_chat[i]-HU_FONTSTART]->width) * con_scalefactor;
+			//charwidth = (hu_font.chars[w_chat[i]-HU_FONTSTART]->width) * con_scalefactor;
 			V_DrawCharacter(HU_INPUTX + c, y, w_chat[i++] | cv_constextsize.value | V_NOSCALESTART | t, true);
 		}
 
diff --git a/src/hu_stuff.h b/src/hu_stuff.h
index 9b7cee2d30..054e8be5d7 100644
--- a/src/hu_stuff.h
+++ b/src/hu_stuff.h
@@ -46,6 +46,15 @@
 extern char *shiftxform; // english translation shift table
 extern char english_shiftxform[];
 
+typedef struct
+{
+	patch_t *chars[HU_FONTSIZE];
+	INT32 width;
+	INT32 height;
+} fontdef_t;
+
+extern fontdef_t hu_font, tny_font;
+
 //------------------------------------
 //        sorted player lines
 //------------------------------------
@@ -78,7 +87,6 @@ void HU_AddChatText(const char *text, boolean playsound);
 // set true when entering a chat message
 extern boolean chat_on;
 
-extern patch_t *hu_font[HU_FONTSIZE], *tny_font[HU_FONTSIZE];
 extern patch_t *tallnum[10];
 extern patch_t *nightsnum[10];
 extern patch_t *lt_font[LT_FONTSIZE];
diff --git a/src/m_menu.c b/src/m_menu.c
index 3c1d8d7caa..be6d45ce38 100644
--- a/src/m_menu.c
+++ b/src/m_menu.c
@@ -6256,7 +6256,7 @@ static void M_DrawMessageMenu(void)
 		}
 
 		V_DrawString((BASEVIDWIDTH - V_StringWidth(string, 0))/2,y,V_ALLOWLOWERCASE,string);
-		y += 8; //hu_font[0]->height;
+		y += 8; //hu_font.chars[0]->height;
 	}
 }
 
@@ -7903,7 +7903,7 @@ static void M_DrawSoundTest(void)
 				{
 					V_DrawFill(165+140-9, y-4, 8, 16, 150);
 					//V_DrawCharacter(165+140-8, y, '\x19' | V_YELLOWMAP, false);
-					V_DrawFixedPatch((165+140-9)<<FRACBITS, (y<<FRACBITS)-(bounce*4), FRACUNIT, 0, hu_font['\x19'-HU_FONTSTART], V_GetStringColormap(V_YELLOWMAP));
+					V_DrawFixedPatch((165+140-9)<<FRACBITS, (y<<FRACBITS)-(bounce*4), FRACUNIT, 0, hu_font.chars['\x19'-HU_FONTSTART], V_GetStringColormap(V_YELLOWMAP));
 				}
 			}
 			t++;
diff --git a/src/st_stuff.c b/src/st_stuff.c
index 959075eedf..ed4afa1a51 100644
--- a/src/st_stuff.c
+++ b/src/st_stuff.c
@@ -505,10 +505,10 @@ static void ST_drawDebugInfo(void)
 								V_DrawRightAlignedThinString(320,  8+lowh, VFLAGS|V_REDMAP, "SOME INFO NOT VISIBLE");\
 								return;\
 							}\
-							V_DrawRightAlignedFontString(320, height, 8, 12, VFLAGS, textscale, textscale, str, hu_font);\
+							V_DrawRightAlignedFontString(320, height, VFLAGS, textscale, textscale, str, hu_font);\
 							height += h;
 
-#define V_DrawDebugFlag(f, str) V_DrawRightAlignedFontString(width, height, 8, 12, VFLAGS|f, textscale, textscale, str, hu_font);\
+#define V_DrawDebugFlag(f, str) V_DrawRightAlignedFontString(width, height, VFLAGS|f, textscale, textscale, str, hu_font);\
 								width -= w
 
 	if (cv_debug & DBG_MEMORY)
diff --git a/src/v_video.c b/src/v_video.c
index e06b987884..7534ad8e42 100644
--- a/src/v_video.c
+++ b/src/v_video.c
@@ -2033,17 +2033,17 @@ void V_DrawCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed)
 		c -= HU_FONTSTART;
 	else
 		c = toupper(c) - HU_FONTSTART;
-	if (c < 0 || c >= HU_FONTSIZE || !hu_font[c])
+	if (c < 0 || c >= HU_FONTSIZE || !hu_font.chars[c])
 		return;
 
-	w = hu_font[c]->width;
+	w = hu_font.chars[c]->width;
 	if (x + w > vid.width)
 		return;
 
 	if (colormap != NULL)
-		V_DrawMappedPatch(x, y, flags, hu_font[c], colormap);
+		V_DrawMappedPatch(x, y, flags, hu_font.chars[c], colormap);
 	else
-		V_DrawScaledPatch(x, y, flags, hu_font[c]);
+		V_DrawScaledPatch(x, y, flags, hu_font.chars[c]);
 }
 
 // Writes a single character for the chat. (draw WHITE if bit 7 set)
@@ -2060,14 +2060,14 @@ void V_DrawChatCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed, UI
 		c -= HU_FONTSTART;
 	else
 		c = toupper(c) - HU_FONTSTART;
-	if (c < 0 || c >= HU_FONTSIZE || !hu_font[c])
+	if (c < 0 || c >= HU_FONTSIZE || !hu_font.chars[c])
 		return;
 
-	w = (vid.width < 640 ) ? ((hu_font[c]->width / 2)) : (hu_font[c]->width);	// use normal sized characters if we're using a terribly low resolution.
+	w = (vid.width < 640 ) ? ((hu_font.chars[c]->width / 2)) : (hu_font.chars[c]->width);	// use normal sized characters if we're using a terribly low resolution.
 	if (x + w > vid.width)
 		return;
 
-	V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, (vid.width < 640) ? (FRACUNIT) : (FRACUNIT/2), flags, hu_font[c], colormap);
+	V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, (vid.width < 640) ? (FRACUNIT) : (FRACUNIT/2), flags, hu_font.chars[c], colormap);
 
 
 }
@@ -2120,13 +2120,13 @@ char *V_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
 			c = toupper(c);
 		c -= HU_FONTSTART;
 
-		if (c < 0 || c >= HU_FONTSIZE || !hu_font[c])
+		if (c < 0 || c >= HU_FONTSIZE || !hu_font.chars[c])
 		{
 			chw = spacewidth;
 			lastusablespace = i;
 		}
 		else
-			chw = (charwidth ? charwidth : hu_font[c]->width);
+			chw = (charwidth ? charwidth : hu_font.chars[c]->width);
 
 		x += chw;
 
@@ -2143,30 +2143,30 @@ char *V_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
 
 // Draw a string, using a supplied font and scale.
 // NOTE: The text is centered for screens larger than the base width.
-void V_DrawFontString(INT32 x, INT32 y, INT32 width, INT32 height, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, patch_t **font)
+void V_DrawFontString(INT32 x, INT32 y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font)
 {
-	V_DrawFontStringAtFixed((fixed_t)x<<FRACBITS, (fixed_t)y<<FRACBITS, width, height, option, pscale, vscale, string, font);
+	V_DrawFontStringAtFixed((fixed_t)x<<FRACBITS, (fixed_t)y<<FRACBITS, option, pscale, vscale, string, font);
 }
 
-void V_DrawCenteredFontString(INT32 x, INT32 y, INT32 width, INT32 height, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, patch_t **font)
+void V_DrawCenteredFontString(INT32 x, INT32 y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font)
 {
-	V_DrawCenteredFontStringAtFixed((fixed_t)x<<FRACBITS, (fixed_t)y<<FRACBITS, width, height, option, pscale, vscale, string, font);
+	V_DrawCenteredFontStringAtFixed((fixed_t)x<<FRACBITS, (fixed_t)y<<FRACBITS, option, pscale, vscale, string, font);
 }
 
-void V_DrawRightAlignedFontString(INT32 x, INT32 y, INT32 width, INT32 height, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, patch_t **font)
+void V_DrawRightAlignedFontString(INT32 x, INT32 y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font)
 {
-	V_DrawRightAlignedFontStringAtFixed((fixed_t)x<<FRACBITS, (fixed_t)y<<FRACBITS, width, height, option, pscale, vscale, string, font);
+	V_DrawRightAlignedFontStringAtFixed((fixed_t)x<<FRACBITS, (fixed_t)y<<FRACBITS, option, pscale, vscale, string, font);
 }
 
 // Write a string, using a supplied font and scale, at fixed_t coordinates.
 // NOTE: The text is centered for screens larger than the base width.
-void V_DrawFontStringAtFixed(fixed_t x, fixed_t y, INT32 width, INT32 height, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, patch_t **font)
+void V_DrawFontStringAtFixed(fixed_t x, fixed_t y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font)
 {
 	fixed_t cx = x, cy = y;
 	INT32 w, c, dupx, dupy, scrwidth, center = 0, left = 0;
 	const char *ch = string;
 	INT32 charflags = (option & V_CHARCOLORMASK);
-	INT32 spacewidth = width/2, charwidth = 0;
+	INT32 spacewidth = font.width/2, charwidth = 0;
 
 	INT32 lowercase = (option & V_ALLOWLOWERCASE);
 	option &= ~V_FLIP; // which is also shared with V_ALLOWLOWERCASE...
@@ -2192,10 +2192,10 @@ void V_DrawFontStringAtFixed(fixed_t x, fixed_t y, INT32 width, INT32 height, IN
 	switch (option & V_SPACINGMASK) // TODO: drop support for these crusty flags in the next major update
 	{
 		case V_MONOSPACE:
-			spacewidth = width;
+			spacewidth = font.width;
 			/* FALLTHRU */
 		case V_OLDSPACING:
-			charwidth = width;
+			charwidth = font.width;
 			break;
 		case V_6WIDTHSPACE:
 			spacewidth = 6;
@@ -2221,7 +2221,7 @@ void V_DrawFontStringAtFixed(fixed_t x, fixed_t y, INT32 width, INT32 height, IN
 			if (option & V_RETURN8)
 				cy += FixedMul((8<<FRACBITS), dupy);
 			else
-				cy += FixedMul((height<<FRACBITS), dupy);
+				cy += FixedMul((font.height<<FRACBITS), dupy);
 
 			continue;
 		}
@@ -2231,7 +2231,7 @@ void V_DrawFontStringAtFixed(fixed_t x, fixed_t y, INT32 width, INT32 height, IN
 			c = toupper(c);
 		c -= HU_FONTSTART;
 
-		if (c < 0 || c >= HU_FONTSIZE || !font[c])
+		if (c < 0 || c >= HU_FONTSIZE || !font.chars[c])
 		{
 			cx += FixedMul((spacewidth<<FRACBITS), dupx);
 			continue;
@@ -2240,10 +2240,10 @@ void V_DrawFontStringAtFixed(fixed_t x, fixed_t y, INT32 width, INT32 height, IN
 		if (charwidth)
 		{
 			w = FixedMul((charwidth<<FRACBITS), dupx);
-			center = w/2 - FixedMul(font[c]->width<<FRACBITS, (dupx/2));
+			center = w/2 - FixedMul(font.chars[c]->width<<FRACBITS, (dupx/2));
 		}
 		else
-			w = FixedMul(font[c]->width<<FRACBITS, dupx);
+			w = FixedMul(font.chars[c]->width<<FRACBITS, dupx);
 
 		if ((cx>>FRACBITS) > scrwidth)
 			continue;
@@ -2253,22 +2253,22 @@ void V_DrawFontStringAtFixed(fixed_t x, fixed_t y, INT32 width, INT32 height, IN
 			continue;
 		}
 
-		V_DrawStretchyFixedPatch(cx + center, cy, pscale, vscale, option, font[c], V_GetStringColormap(charflags));
+		V_DrawStretchyFixedPatch(cx + center, cy, pscale, vscale, option, font.chars[c], V_GetStringColormap(charflags));
 
 		cx += w;
 	}
 }
 
-void V_DrawCenteredFontStringAtFixed(fixed_t x, fixed_t y, INT32 width, INT32 height, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, patch_t **font)
+void V_DrawCenteredFontStringAtFixed(fixed_t x, fixed_t y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font)
 {
-	x -= (V_FontStringWidth(string, option, width, font)*pscale)/2;
-	V_DrawFontStringAtFixed(x, y, width, height, option, pscale, vscale, string, font);
+	x -= (V_FontStringWidth(string, option, font)*pscale)/2;
+	V_DrawFontStringAtFixed(x, y, option, pscale, vscale, string, font);
 }
 
-void V_DrawRightAlignedFontStringAtFixed(fixed_t x, fixed_t y, INT32 width, INT32 height, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, patch_t **font)
+void V_DrawRightAlignedFontStringAtFixed(fixed_t x, fixed_t y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font)
 {
-	x -= V_FontStringWidth(string, option, width, font)*pscale;
-	V_DrawFontStringAtFixed(x, y, width, height, option, pscale, vscale, string, font);
+	x -= V_FontStringWidth(string, option, font)*pscale;
+	V_DrawFontStringAtFixed(x, y, option, pscale, vscale, string, font);
 }
 
 // Draws a tallnum.  Replaces two functions in y_inter and st_stuff
@@ -2739,19 +2739,19 @@ INT16 V_LevelActNumWidth(UINT8 num)
 
 // Find string width from supplied font characters & character width.
 //
-INT32 V_FontStringWidth(const char *string, INT32 option, INT32 width, patch_t **font)
+INT32 V_FontStringWidth(const char *string, INT32 option, fontdef_t font)
 {
 	INT32 c, w = 0;
-	INT32 spacewidth = width/2, charwidth = 0;
+	INT32 spacewidth = font.width/2, charwidth = 0;
 	size_t i;
 
 	switch (option & V_SPACINGMASK)
 	{
 		case V_MONOSPACE:
-			spacewidth = width;
+			spacewidth = font.width;
 			/* FALLTHRU */
 		case V_OLDSPACING:
-			charwidth = width;
+			charwidth = font.width;
 			break;
 		case V_6WIDTHSPACE:
 			spacewidth = 6;
@@ -2764,10 +2764,10 @@ INT32 V_FontStringWidth(const char *string, INT32 option, INT32 width, patch_t *
 		if (string[i] & 0x80)
 			continue;
 		c = toupper(string[i]) - HU_FONTSTART;
-		if (c < 0 || c >= HU_FONTSIZE || !font[c])
+		if (c < 0 || c >= HU_FONTSIZE || !font.chars[c])
 			w += spacewidth;
 		else
-			w += (charwidth ? charwidth : (font[c]->width));
+			w += (charwidth ? charwidth : (font.chars[c]->width));
 	}
 
 	if (option & (V_NOSCALESTART|V_NOSCALEPATCH))
diff --git a/src/v_video.h b/src/v_video.h
index acc2841bea..71cfa4b1f0 100644
--- a/src/v_video.h
+++ b/src/v_video.h
@@ -210,48 +210,48 @@ char *V_WordWrap(INT32 x, INT32 w, INT32 option, const char *string);
 UINT8 *V_GetStringColormap(INT32 colorflags);
 
 // Draw a string, using a supplied font and scale.
-void V_DrawFontString(INT32 x, INT32 y, INT32 width, INT32 height, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, patch_t **font);
-void V_DrawCenteredFontString(INT32 x, INT32 y, INT32 width, INT32 height, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, patch_t **font);
-void V_DrawRightAlignedFontString(INT32 x, INT32 y, INT32 width, INT32 height, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, patch_t **font);
+void V_DrawFontString(INT32 x, INT32 y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font);
+void V_DrawCenteredFontString(INT32 x, INT32 y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font);
+void V_DrawRightAlignedFontString(INT32 x, INT32 y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font);
 // Draw a string, using a supplied font and scale, at fixed_t coordinates.
-void V_DrawFontStringAtFixed(fixed_t x, fixed_t y, INT32 width, INT32 height, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, patch_t **font);
-void V_DrawCenteredFontStringAtFixed(fixed_t x, fixed_t y, INT32 width, INT32 height, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, patch_t **font);
-void V_DrawRightAlignedFontStringAtFixed(fixed_t x, fixed_t y, INT32 width, INT32 height, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, patch_t **font);
+void V_DrawFontStringAtFixed(fixed_t x, fixed_t y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font);
+void V_DrawCenteredFontStringAtFixed(fixed_t x, fixed_t y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font);
+void V_DrawRightAlignedFontStringAtFixed(fixed_t x, fixed_t y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font);
 // width = "average" character width (divided by 2 for space width), height = distance between two lines. TODO: incorporate these in the supplied font, somehow
 
 // Defines for old string drawers.
 // draw a string using the hu_font
-#define V_DrawString(x,y,o,str) V_DrawFontString(x,y,8,12,o,FRACUNIT,FRACUNIT,str,hu_font)
-#define V_DrawCenteredString(x,y,o,str) V_DrawCenteredFontString(x,y,8,12,o,FRACUNIT,FRACUNIT,str,hu_font)
-#define V_DrawRightAlignedString(x,y,o,str) V_DrawRightAlignedFontString(x,y,8,12,o,FRACUNIT,FRACUNIT,str,hu_font)
+#define V_DrawString(x,y,o,str) V_DrawFontString(x,y,o,FRACUNIT,FRACUNIT,str,hu_font)
+#define V_DrawCenteredString(x,y,o,str) V_DrawCenteredFontString(x,y,o,FRACUNIT,FRACUNIT,str,hu_font)
+#define V_DrawRightAlignedString(x,y,o,str) V_DrawRightAlignedFontString(x,y,o,FRACUNIT,FRACUNIT,str,hu_font)
 // draw a string using the hu_font, 0.5x scale
-#define V_DrawSmallString(x,y,o,str) V_DrawFontString(x,y,8,12,o,FRACUNIT/2,FRACUNIT/2,str,hu_font)
-#define V_DrawCenteredSmallString(x,y,o,str) V_DrawCenteredFontString(x,y,8,12,o,FRACUNIT/2,FRACUNIT/2,str,hu_font)
-#define V_DrawRightAlignedSmallString(x,y,o,str) V_DrawRightAlignedFontString(x,y,8,12,o,FRACUNIT/2,FRACUNIT/2,str,hu_font)
+#define V_DrawSmallString(x,y,o,str) V_DrawFontString(x,y,o,FRACUNIT/2,FRACUNIT/2,str,hu_font)
+#define V_DrawCenteredSmallString(x,y,o,str) V_DrawCenteredFontString(x,y,o,FRACUNIT/2,FRACUNIT/2,str,hu_font)
+#define V_DrawRightAlignedSmallString(x,y,o,str) V_DrawRightAlignedFontString(x,y,o,FRACUNIT/2,FRACUNIT/2,str,hu_font)
 // Write a string using the tny_font
-#define V_DrawThinString(x,y,o,str) V_DrawFontString(x,y,5,12,o,FRACUNIT,FRACUNIT,str,tny_font)
-#define V_DrawCenteredThinString(x,y,o,str) V_DrawCenteredFontString(x,y,5,12,o,FRACUNIT,FRACUNIT,str,tny_font)
-#define V_DrawRightAlignedThinString(x,y,o,str) V_DrawRightAlignedFontString(x,y,5,12,o,FRACUNIT,FRACUNIT,str,tny_font)
+#define V_DrawThinString(x,y,o,str) V_DrawFontString(x,y,o,FRACUNIT,FRACUNIT,str,tny_font)
+#define V_DrawCenteredThinString(x,y,o,str) V_DrawCenteredFontString(x,y,o,FRACUNIT,FRACUNIT,str,tny_font)
+#define V_DrawRightAlignedThinString(x,y,o,str) V_DrawRightAlignedFontString(x,y,o,FRACUNIT,FRACUNIT,str,tny_font)
 // draw a string using the tny_font, 0.5x scale
-#define V_DrawSmallThinString(x,y,o,str) V_DrawFontString(x,y,5,12,o,FRACUNIT/2,FRACUNIT/2,str,tny_font)
-#define V_DrawCenteredSmallThinString(x,y,o,str) V_DrawCenteredFontString(x,y,5,12,o,FRACUNIT/2,FRACUNIT/2,str,tny_font)
-#define V_DrawRightAlignedSmallThinString(x,y,o,str) V_DrawRightAlignedFontString(x,y,5,12,o,FRACUNIT/2,FRACUNIT/2,str,tny_font)
+#define V_DrawSmallThinString(x,y,o,str) V_DrawFontString(x,y,o,FRACUNIT/2,FRACUNIT/2,str,tny_font)
+#define V_DrawCenteredSmallThinString(x,y,o,str) V_DrawCenteredFontString(x,y,o,FRACUNIT/2,FRACUNIT/2,str,tny_font)
+#define V_DrawRightAlignedSmallThinString(x,y,o,str) V_DrawRightAlignedFontString(x,y,o,FRACUNIT/2,FRACUNIT/2,str,tny_font)
 // draw a string using the hu_font at fixed_t coordinates
-#define V_DrawStringAtFixed(x,y,o,str) V_DrawFontStringAtFixed(x,y,8,12,o,FRACUNIT,FRACUNIT,str,hu_font)
-#define V_DrawCenteredStringAtFixed(x,y,o,str) V_DrawCenteredFontStringAtFixed(x,y,8,12,o,FRACUNIT,FRACUNIT,str,hu_font)
-#define V_DrawRightAlignedStringAtFixed(x,y,o,str) V_DrawRightAlignedFontStringAtFixed(x,y,8,12,o,FRACUNIT,FRACUNIT,str,hu_font)
+#define V_DrawStringAtFixed(x,y,o,str) V_DrawFontStringAtFixed(x,y,o,FRACUNIT,FRACUNIT,str,hu_font)
+#define V_DrawCenteredStringAtFixed(x,y,o,str) V_DrawCenteredFontStringAtFixed(x,y,o,FRACUNIT,FRACUNIT,str,hu_font)
+#define V_DrawRightAlignedStringAtFixed(x,y,o,str) V_DrawRightAlignedFontStringAtFixed(x,y,o,FRACUNIT,FRACUNIT,str,hu_font)
 // draw a string using the hu_font at fixed_t coordinates, 0.5x scale
-#define V_DrawSmallStringAtFixed(x,y,o,str) V_DrawFontStringAtFixed(x,y,8,12,o,FRACUNIT/2,FRACUNIT/2,str,hu_font)
-#define V_DrawCenteredSmallStringAtFixed(x,y,o,str) V_DrawCenteredFontStringAtFixed(x,y,8,12,o,FRACUNIT/2,FRACUNIT/2,str,hu_font)
-#define V_DrawRightAlignedSmallStringAtFixed(x,y,o,str) V_DrawRightAlignedFontStringAtFixed(x,y,8,12,o,FRACUNIT/2,FRACUNIT/2,str,hu_font)
+#define V_DrawSmallStringAtFixed(x,y,o,str) V_DrawFontStringAtFixed(x,y,o,FRACUNIT/2,FRACUNIT/2,str,hu_font)
+#define V_DrawCenteredSmallStringAtFixed(x,y,o,str) V_DrawCenteredFontStringAtFixed(x,y,o,FRACUNIT/2,FRACUNIT/2,str,hu_font)
+#define V_DrawRightAlignedSmallStringAtFixed(x,y,o,str) V_DrawRightAlignedFontStringAtFixed(x,y,o,FRACUNIT/2,FRACUNIT/2,str,hu_font)
 // draw a string using the tny_font at fixed_t coordinates
-#define V_DrawThinStringAtFixed(x,y,o,str) V_DrawFontStringAtFixed(x,y,5,12,o,FRACUNIT,FRACUNIT,str,tny_font)
-#define V_DrawCenteredThinStringAtFixed(x,y,o,str) V_DrawCenteredFontStringAtFixed(x,y,5,12,o,FRACUNIT,FRACUNIT,str,tny_font)
-#define V_DrawRightAlignedThinStringAtFixed(x,y,o,str) V_DrawRightAlignedFontStringAtFixed(x,y,5,12,o,FRACUNIT,FRACUNIT,str,tny_font)
+#define V_DrawThinStringAtFixed(x,y,o,str) V_DrawFontStringAtFixed(x,y,o,FRACUNIT,FRACUNIT,str,tny_font)
+#define V_DrawCenteredThinStringAtFixed(x,y,o,str) V_DrawCenteredFontStringAtFixed(x,y,o,FRACUNIT,FRACUNIT,str,tny_font)
+#define V_DrawRightAlignedThinStringAtFixed(x,y,o,str) V_DrawRightAlignedFontStringAtFixed(x,y,o,FRACUNIT,FRACUNIT,str,tny_font)
 // draw a string using the tny_font at fixed_t coordinates, 0.5x scale
-#define V_DrawSmallThinStringAtFixed(x,y,o,str) V_DrawFontStringAtFixed(x,y,5,12,o,FRACUNIT/2,FRACUNIT/2,str,tny_font)
-#define V_DrawCenteredSmallThinStringAtFixed(x,y,o,str) V_DrawCenteredFontStringAtFixed(x,y,5,12,o,FRACUNIT/2,FRACUNIT/2,str,tny_font)
-#define V_DrawRightAlignedSmallThinStringAtFixed(x,y,o,str) V_DrawRightAlignedFontStringAtFixed(x,y,5,12,o,FRACUNIT/2,FRACUNIT/2,str,tny_font)
+#define V_DrawSmallThinStringAtFixed(x,y,o,str) V_DrawFontStringAtFixed(x,y,o,FRACUNIT/2,FRACUNIT/2,str,tny_font)
+#define V_DrawCenteredSmallThinStringAtFixed(x,y,o,str) V_DrawCenteredFontStringAtFixed(x,y,o,FRACUNIT/2,FRACUNIT/2,str,tny_font)
+#define V_DrawRightAlignedSmallThinStringAtFixed(x,y,o,str) V_DrawRightAlignedFontStringAtFixed(x,y,o,FRACUNIT/2,FRACUNIT/2,str,tny_font)
 
 // Draw tall nums, used for menu, HUD, intermission
 void V_DrawTallNum(INT32 x, INT32 y, INT32 flags, INT32 num);
@@ -272,13 +272,13 @@ INT32 V_CountNameTagLines(const char *string);
 INT32 V_NameTagWidth(const char *string);
 
 // Find string width from supplied font chars
-INT32 V_FontStringWidth(const char *string, INT32 option, INT32 width, patch_t **font);
+INT32 V_FontStringWidth(const char *string, INT32 option, fontdef_t font);
 
 // Defines for old string width functions.
-#define V_StringWidth(str,o) V_FontStringWidth(str,o,8,hu_font)
-#define V_SmallStringWidth(str,o) V_FontStringWidth(str,o,8,hu_font)/2
-#define V_ThinStringWidth(str,o) V_FontStringWidth(str,o,5,tny_font)
-#define V_SmallThinStringWidth(str,o) V_FontStringWidth(str,o,5,tny_font)/2
+#define V_StringWidth(str,o) V_FontStringWidth(str,o,hu_font)
+#define V_SmallStringWidth(str,o) V_FontStringWidth(str,o,hu_font)/2
+#define V_ThinStringWidth(str,o) V_FontStringWidth(str,o,tny_font)
+#define V_SmallThinStringWidth(str,o) V_FontStringWidth(str,o,tny_font)/2
 
 void V_DoPostProcessor(INT32 view, postimg_t type, INT32 param);
 
-- 
GitLab