SCI: Fixed bug #3040161 - "LONGBOW: Textbox glitch"

GetLongest() could exceed the maximum width with the very last
character of a word. The same fix has been applied to the SCI32 code.
This commit is contained in:
md5 2011-03-02 20:38:21 +02:00
parent ba42c6ff7d
commit b1055a3c86
2 changed files with 4 additions and 0 deletions

View File

@ -337,6 +337,8 @@ static int16 GetLongest(const char *text, int16 maxWidth, GfxFont *font) {
maxChars = curCharCount; // return count up to (but not including) breaking space
break;
}
if (width + font->getCharWidth(curChar) > maxWidth)
break;
width += font->getCharWidth(curChar);
curCharCount++;
}

View File

@ -204,6 +204,8 @@ int16 GfxText16::GetLongest(const char *text, int16 maxWidth, GuiResourceId orgF
maxChars = curCharCount; // return count up to (but not including) breaking space
break;
}
if (width + _font->getCharWidth(curChar) > maxWidth)
break;
width += _font->getCharWidth(curChar);
curCharCount++;
}