mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-27 11:41:16 +00:00
Use V_FontStringWidth for name tag width, add kerning value to name tag
This commit is contained in:
parent
48cceef746
commit
f95b6df128
3 changed files with 3 additions and 24 deletions
|
@ -236,7 +236,7 @@ void HU_LoadGraphics(void)
|
|||
HU_SetFontProperties(&tny_font, 0, 2, 12);
|
||||
HU_SetFontProperties(&cred_font, 0, 16, 16);
|
||||
HU_SetFontProperties(<_font, 0, 16, 20);
|
||||
HU_SetFontProperties(&ntb_font, 0, 4, 21);
|
||||
HU_SetFontProperties(&ntb_font, 2, 4, 21);
|
||||
HU_SetFontProperties(&nto_font, 0, 4, 21);
|
||||
|
||||
//cache numbers too!
|
||||
|
|
|
@ -2393,7 +2393,7 @@ static void V_DrawNameTagLine(INT32 x, INT32 y, INT32 option, fixed_t scale, UIN
|
|||
continue;
|
||||
}
|
||||
|
||||
w = FixedMul(((ntb_font.chars[c]->width)+2 * dupx) * FRACUNIT, scale);
|
||||
w = FixedMul(((ntb_font.chars[c]->width)+ntb_font.kerning * dupx) * FRACUNIT, scale);
|
||||
|
||||
if (FixedInt(cx) > scrwidth)
|
||||
continue;
|
||||
|
@ -2519,27 +2519,6 @@ INT32 V_CountNameTagLines(const char *string)
|
|||
return ntlines;
|
||||
}
|
||||
|
||||
INT32 V_NameTagWidth(const char *string)
|
||||
{
|
||||
INT32 c, w = 0;
|
||||
size_t i;
|
||||
|
||||
// It's possible for string to be a null pointer
|
||||
if (!string)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < strlen(string); i++)
|
||||
{
|
||||
c = toupper(string[i]) - FONTSTART;
|
||||
if (c < 0 || c >= FONTSIZE || !ntb_font.chars[c] || !nto_font.chars[c])
|
||||
w += ntb_font.spacewidth;
|
||||
else
|
||||
w += (ntb_font.chars[c]->width)+2;
|
||||
}
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
// Find string width from supplied font characters & character width.
|
||||
//
|
||||
INT32 V_FontStringWidth(const char *string, INT32 option, fontdef_t font)
|
||||
|
|
|
@ -261,7 +261,6 @@ INT16 V_LevelActNumWidth(UINT8 num); // act number width
|
|||
// Draw a string using the nt_font
|
||||
void V_DrawNameTag(INT32 x, INT32 y, INT32 option, fixed_t scale, UINT8 *basecolormap, UINT8 *outlinecolormap, const char *string);
|
||||
INT32 V_CountNameTagLines(const char *string);
|
||||
INT32 V_NameTagWidth(const char *string);
|
||||
|
||||
// Find string width or height from supplied font chars
|
||||
INT32 V_FontStringWidth(const char *string, INT32 option, fontdef_t font);
|
||||
|
@ -273,6 +272,7 @@ INT32 V_FontStringHeight(const char *string, fontdef_t font);
|
|||
#define V_ThinStringWidth(str,o) V_FontStringWidth(str,o,tny_font)
|
||||
#define V_SmallThinStringWidth(str,o) V_FontStringWidth(str,o,tny_font)/2
|
||||
#define V_CreditStringWidth(str) V_FontStringWidth(str,0,cred_font)
|
||||
#define V_NameTagWidth(str) V_FontStringWidth(str,0,ntb_font)
|
||||
#define V_LevelNameWidth(str) V_FontStringWidth(str,V_ALLOWLOWERCASE,lt_font)
|
||||
#define V_LevelNameHeight(str) V_FontStringHeight(str,lt_font)
|
||||
|
||||
|
|
Loading…
Reference in a new issue