diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp index 4780832f553..03c2bd46ed1 100644 --- a/engines/scumm/charset.cpp +++ b/engines/scumm/charset.cpp @@ -1632,12 +1632,16 @@ int CharsetRendererMac::getStringWidth(int arg, const byte *text, uint strLenMax if (chr == 1) // 'Newline' break; } - width += _macFonts[_curId].getCharWidth(chr); + width += getDrawWidthIntern(chr); } return width / 2; } +int CharsetRendererMac::getDrawWidthIntern(uint16 chr) { + return _macFonts[_curId].getCharWidth(chr); +} + // HACK: Usually, we want the approximate width and height in the unscaled // graphics resolution. But for font 1 in Indiana Jones and the Last // crusade we want the actual dimensions for drawing the text boxes. @@ -1654,7 +1658,7 @@ int CharsetRendererMac::getFontHeight() { } int CharsetRendererMac::getCharWidth(uint16 chr) { - int width = _macFonts[_curId].getCharWidth(chr); + int width = getDrawWidthIntern(chr); // For font 1 in Last Crusade, we want the real width. It is used for // text box titles, which are drawn outside the normal font rendering. @@ -1759,16 +1763,27 @@ void CharsetRendererMac::printChar(int chr, bool ignoreCharsetMask) { // Mark the virtual screen as dirty, using downscaled coordinates. - int left, right, top, bottom; + int left, right, top, bottom, width; + + width = getDrawWidthIntern(chr); + + // HACK: Indiana Jones and the Last Crusade uses incorrect spacing + // betweeen letters. Note that this incorrect spacing does not extend + // to the text boxes, nor does it seem to be used when figuring out + // the width of a string (e.g. to center text on screen). It is, + // however, used for things like the Grail Diary. + + if (_vm->_game.id == GID_INDY3 && !drawToTextBox && (width & 1)) + width++; if (enableShadow) { left = macLeft / 2; - right = (macLeft + _macFonts[_curId].getCharWidth(chr) + 3) / 2; + right = (macLeft + width + 3) / 2; top = macTop / 2; bottom = (macTop + _macFonts[_curId].getFontHeight() + 3) / 2; } else { left = (macLeft + 1) / 2; - right = (macLeft + _macFonts[_curId].getCharWidth(chr) + 1) / 2; + right = (macLeft + width + 1) / 2; top = (macTop + 1) / 2; bottom = (macTop + _macFonts[_curId].getFontHeight() + 1) / 2; } @@ -1799,7 +1814,7 @@ void CharsetRendererMac::printChar(int chr, bool ignoreCharsetMask) { // The next character may have to be adjusted to compensate for // rounding errors. - macLeft += _macFonts[_curId].getCharWidth(chr); + macLeft += width; if (macLeft & 1) _pad = true; diff --git a/engines/scumm/charset.h b/engines/scumm/charset.h index 0301a977c9f..500af1924f1 100644 --- a/engines/scumm/charset.h +++ b/engines/scumm/charset.h @@ -281,6 +281,8 @@ protected: bool _pad; int _lastTop; + int getDrawWidthIntern(uint16 chr); + void printCharInternal(int chr, int color, bool shadow, int x, int y); void printCharToTextBox(int chr, int color, int x, int y);