diff options
author | Max Horn | 2002-09-20 23:40:55 +0000 |
---|---|---|
committer | Max Horn | 2002-09-20 23:40:55 +0000 |
commit | b91da0e29f4fbe2d9873a4f45e532af46d1c2b8e (patch) | |
tree | 4a9d87b6c8cb647cbcab1d3538a3c3cc3df3e74e /scumm/string.cpp | |
parent | 1917ea9a774880510d23ff053a476ea65d02eb5f (diff) | |
download | scummvm-rg350-b91da0e29f4fbe2d9873a4f45e532af46d1c2b8e.tar.gz scummvm-rg350-b91da0e29f4fbe2d9873a4f45e532af46d1c2b8e.tar.bz2 scummvm-rg350-b91da0e29f4fbe2d9873a4f45e532af46d1c2b8e.zip |
Patch #612277: text rendering crash + spacing issue
svn-id: r4983
Diffstat (limited to 'scumm/string.cpp')
-rw-r--r-- | scumm/string.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/scumm/string.cpp b/scumm/string.cpp index 02cf806d57..cd74b7658c 100644 --- a/scumm/string.cpp +++ b/scumm/string.cpp @@ -71,6 +71,7 @@ int CharsetRenderer::getStringWidth(int arg, byte *text, int pos) } width += getSpacing(chr, ptr); } + return width; } @@ -125,6 +126,7 @@ void CharsetRenderer::addLinebreaks(int a, byte *str, int pos, int maxwidth) if (chr == ' ') lastspace = pos - 1; + curw += getSpacing(chr, ptr); if (lastspace == -1) continue; @@ -1019,20 +1021,20 @@ void CharsetRenderer::drawBits() } // do spacing for variable width old-style font -int CharsetRenderer::getSpacing(char chr, byte *ptr) +int CharsetRenderer::getSpacing(byte chr, byte *charset) { - int spacing; + int spacing = 0; if (_vm->_features & GF_OLD256) { - spacing = *(ptr - 11 + chr); + spacing = *(charset - 11 + chr); } else { - int offs = READ_LE_UINT32(ptr + chr * 4 + 4); + int offs = READ_LE_UINT32(charset + chr * 4 + 4); if (offs) { - spacing = ptr[offs]; - if (ptr[offs + 2] >= 0x80) { - spacing += ptr[offs + 2] - 0x100; + spacing = charset[offs]; + if (charset[offs + 2] >= 0x80) { + spacing += charset[offs + 2] - 0x100; } else { - spacing += ptr[offs + 2]; + spacing += charset[offs + 2]; } } } |