diff options
author | md5 | 2011-03-02 20:38:21 +0200 |
---|---|---|
committer | md5 | 2011-03-02 20:38:21 +0200 |
commit | b1055a3c86028d517d54fbae0bef9c500facf8c7 (patch) | |
tree | c425d645d0babc6249b8e703b0d40b32fe7774f6 | |
parent | ba42c6ff7db37266062d8a03e83a2ff96714b8af (diff) | |
download | scummvm-rg350-b1055a3c86028d517d54fbae0bef9c500facf8c7.tar.gz scummvm-rg350-b1055a3c86028d517d54fbae0bef9c500facf8c7.tar.bz2 scummvm-rg350-b1055a3c86028d517d54fbae0bef9c500facf8c7.zip |
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.
-rw-r--r-- | engines/sci/graphics/frameout.cpp | 2 | ||||
-rw-r--r-- | engines/sci/graphics/text16.cpp | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index 87acfdeeb3..fbfd140e6b 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -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++; } diff --git a/engines/sci/graphics/text16.cpp b/engines/sci/graphics/text16.cpp index 21605ccb8e..d7a92042eb 100644 --- a/engines/sci/graphics/text16.cpp +++ b/engines/sci/graphics/text16.cpp @@ -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++; } |