- a few more exports from FFont.

This commit is contained in:
Christoph Oelckers 2017-02-05 13:55:05 +01:00
commit d8a1ce88b0
4 changed files with 70 additions and 53 deletions

View file

@ -167,48 +167,6 @@ void DCanvas::DrawText(FFont *font, int normalcolor, int x, int y, const char *s
}
//
// Find string width using this font
//
int FFont::StringWidth (const BYTE *string) const
{
int w = 0;
int maxw = 0;
while (*string)
{
if (*string == TEXTCOLOR_ESCAPE)
{
++string;
if (*string == '[')
{
while (*string != '\0' && *string != ']')
{
++string;
}
}
if (*string != '\0')
{
++string;
}
continue;
}
else if (*string == '\n')
{
if (w > maxw)
maxw = w;
w = 0;
++string;
}
else
{
w += GetCharWidth (*string++) + GlobalKerning;
}
}
return MAX (maxw, w);
}
//
// Break long lines of text into multiple lines no longer than maxwidth pixels
//