mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-27 15:10:30 -04:00
parent
177f358d65
commit
354f6f7b3c
24
src/m_menu.c
24
src/m_menu.c
@ -6841,10 +6841,26 @@ void M_DrawSelCell (menu_t* menu,int item)
|
|||||||
|
|
||||||
int M_StringWidth(const char *string)
|
int M_StringWidth(const char *string)
|
||||||
{
|
{
|
||||||
int i, c, w = 0;
|
int c, w = 0;
|
||||||
for (i = 0;i < strlen(string);i++)
|
|
||||||
w += (c = toupper(string[i]) - HU_FONTSTART) < 0 || c >= HU_FONTSIZE ?
|
while (*string)
|
||||||
4 : SHORT(hu_font[c]->width);
|
{
|
||||||
|
c = *string++;
|
||||||
|
if (c == '\x1b') // skip code for color change
|
||||||
|
{
|
||||||
|
if (*string)
|
||||||
|
string++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
c = toupper(c) - HU_FONTSTART;
|
||||||
|
if (c < 0 || c > HU_FONTSIZE)
|
||||||
|
{
|
||||||
|
w += SPACEWIDTH;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
w += SHORT(hu_font[c]->width);
|
||||||
|
}
|
||||||
|
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user