Skip to content

Commit

Permalink
SCI: Fixed bug #3040161 - "LONGBOW: Textbox glitch"
Browse files Browse the repository at this point in the history
GetLongest() could exceed the maximum width with the very last
character of a word. The same fix has been applied to the SCI32 code.
  • Loading branch information
bluegr committed Mar 2, 2011
1 parent ba42c6f commit b1055a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions engines/sci/graphics/frameout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
Expand Down
2 changes: 2 additions & 0 deletions engines/sci/graphics/text16.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
Expand Down

0 comments on commit b1055a3

Please sign in to comment.