From f8778a5e04b5cc46a898d9d6c570f506e7d3b58c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Aug 2014 21:43:24 -0400 Subject: [PATCH] ACCESS: Fix getLine when \r occurs just after maximum line width reached --- engines/access/font.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/access/font.cpp b/engines/access/font.cpp index 75add4129c9a..ffc1715c392e 100644 --- a/engines/access/font.cpp +++ b/engines/access/font.cpp @@ -74,6 +74,9 @@ void Font::load(const int *fontIndex, const byte *fontData) { } int Font::charWidth(char c) { + if (c < ' ') + return 0; + return _chars[c - ' '].w; } @@ -95,7 +98,7 @@ bool Font::getLine(Common::String &s, int maxWidth, Common::String &line, int &w while ((c = *src) != '\0') { if (c == '\r') { // End of line, so return calculated line - line = Common::String(s.c_str(), src - 1); + line = Common::String(s.c_str(), src); s = Common::String(src + 1); return false; }