- a few more exports from FFont.
This commit is contained in:
parent
ef871ec09f
commit
d8a1ce88b0
4 changed files with 70 additions and 53 deletions
|
|
@ -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
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue