From b67db7baf5fae6ad24174a4eafd3e5a76566b462 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 28 Jul 2008 12:46:30 +0000 Subject: Cleanup svn-id: r33373 --- engines/saga/font.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'engines/saga/font.cpp') diff --git a/engines/saga/font.cpp b/engines/saga/font.cpp index 7789949393..482b3a4c82 100644 --- a/engines/saga/font.cpp +++ b/engines/saga/font.cpp @@ -240,6 +240,13 @@ void Font::createOutline(FontData *font) { } } +int Font::translateChar(int charId) { + if (charId <= 127) + return charId; // normal character + else + return _charMap[charId - 128]; // extended character +} + // Returns the horizontal length in pixels of the graphical representation // of at most 'count' characters of the string 'text', taking // into account any formatting options specified by 'flags'. @@ -259,7 +266,7 @@ int Font::getStringWidth(FontId fontId, const char *text, size_t count, FontEffe for (ct = count; *txt && (!count || ct > 0); txt++, ct--) { ch = *txt & 0xFFU; // Translate character - ch = _charMap[ch]; + ch = translateChar(ch); assert(ch < FONT_CHARCOUNT); width += font->normal.fontCharEntry[ch].tracking; } @@ -338,11 +345,11 @@ void Font::outFont(const FontStyle &drawFont, Surface *ds, const char *text, siz // Don't do any special font mapping for the Italian fan // translation of ITE if (_vm->getLanguage() != Common::IT_ITA) - c_code = _charMap[c_code]; + c_code = translateChar(c_code); } } else if (_fontMapping == 1) { // Force font mapping - c_code = _charMap[c_code]; + c_code = translateChar(c_code); } else { // In all other cases, ignore font mapping } -- cgit v1.2.3