aboutsummaryrefslogtreecommitdiff
path: root/engines/saga/font.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2008-07-28 12:46:30 +0000
committerFilippos Karapetis2008-07-28 12:46:30 +0000
commitb67db7baf5fae6ad24174a4eafd3e5a76566b462 (patch)
treea91fdef15cb5e8e9615b48cccda3097df8c50a46 /engines/saga/font.cpp
parenta1557bd776c9335b36313860d437bc8b1ef2a936 (diff)
downloadscummvm-rg350-b67db7baf5fae6ad24174a4eafd3e5a76566b462.tar.gz
scummvm-rg350-b67db7baf5fae6ad24174a4eafd3e5a76566b462.tar.bz2
scummvm-rg350-b67db7baf5fae6ad24174a4eafd3e5a76566b462.zip
Cleanup
svn-id: r33373
Diffstat (limited to 'engines/saga/font.cpp')
-rw-r--r--engines/saga/font.cpp13
1 files changed, 10 insertions, 3 deletions
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
}