diff options
Diffstat (limited to 'engines/wintermute/base')
-rw-r--r-- | engines/wintermute/base/font/base_font_truetype.cpp | 10 | ||||
-rw-r--r-- | engines/wintermute/base/font/base_font_truetype.h | 1 |
2 files changed, 7 insertions, 4 deletions
diff --git a/engines/wintermute/base/font/base_font_truetype.cpp b/engines/wintermute/base/font/base_font_truetype.cpp index 93084ca8a1..03d82cb940 100644 --- a/engines/wintermute/base/font/base_font_truetype.cpp +++ b/engines/wintermute/base/font/base_font_truetype.cpp @@ -48,6 +48,7 @@ IMPLEMENT_PERSISTENT(BaseFontTT, false) BaseFontTT::BaseFontTT(BaseGame *inGame) : BaseFont(inGame) { _fontHeight = 12; _isBold = _isItalic = _isUnderline = _isStriked = false; + _charset = CHARSET_ANSI; _fontFile = nullptr; _font = nullptr; @@ -116,7 +117,7 @@ int BaseFontTT::getTextWidth(const byte *text, int maxLength) { if (_gameRef->_textEncoding == TEXT_UTF8) { textStr = StringUtil::utf8ToWide((const char *)text); } else { - textStr = StringUtil::ansiToWide((const char *)text); + textStr = StringUtil::ansiToWide((const char *)text, _charset); } if (maxLength >= 0 && textStr.size() > (uint32)maxLength) { @@ -137,7 +138,7 @@ int BaseFontTT::getTextHeight(const byte *text, int width) { if (_gameRef->_textEncoding == TEXT_UTF8) { textStr = StringUtil::utf8ToWide((const char *)text); } else { - textStr = StringUtil::ansiToWide((const char *)text); + textStr = StringUtil::ansiToWide((const char *)text, _charset); } @@ -162,7 +163,7 @@ void BaseFontTT::drawText(const byte *text, int x, int y, int width, TTextAlign if (_gameRef->_textEncoding == TEXT_UTF8) { textStr = StringUtil::utf8ToWide((const char *)text); } else { - textStr = StringUtil::ansiToWide((const char *)text); + textStr = StringUtil::ansiToWide((const char *)text, _charset); } if (maxLength >= 0 && textStr.size() > (uint32)maxLength) { @@ -412,7 +413,7 @@ bool BaseFontTT::loadBuffer(char *buffer) { break; case TOKEN_CHARSET: - // we don't need this anymore + parser.scanStr(params, "%d", &_charset); break; case TOKEN_COLOR: { @@ -519,6 +520,7 @@ bool BaseFontTT::persist(BasePersistenceManager *persistMgr) { persistMgr->transferBool(TMEMBER(_isStriked)); persistMgr->transferSint32(TMEMBER(_fontHeight)); persistMgr->transferCharPtr(TMEMBER(_fontFile)); + persistMgr->transferSint32(TMEMBER_INT(_charset)); // persist layers diff --git a/engines/wintermute/base/font/base_font_truetype.h b/engines/wintermute/base/font/base_font_truetype.h index c0349eccd4..d74efa067f 100644 --- a/engines/wintermute/base/font/base_font_truetype.h +++ b/engines/wintermute/base/font/base_font_truetype.h @@ -141,6 +141,7 @@ private: bool _isStriked; int32 _fontHeight; char *_fontFile; + TTextCharset _charset; BaseArray<BaseTTFontLayer *> _layers; void clearCache(); |