mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 14:18:37 +00:00
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:
parent
ba42c6ff7d
commit
b1055a3c86
@ -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++;
|
||||
}
|
||||
|
@ -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++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user