diff options
author | Martin Kiewitz | 2010-04-19 20:15:31 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-04-19 20:15:31 +0000 |
commit | 75f7536ca18ce6e72e21f961d214b31f695378fd (patch) | |
tree | fe95e56e0719d88885e361e00af4d8fdf9c27bec /engines | |
parent | 4fd93aa27cb0b8762c0233ce7f2746d2bdaee569 (diff) | |
download | scummvm-rg350-75f7536ca18ce6e72e21f961d214b31f695378fd.tar.gz scummvm-rg350-75f7536ca18ce6e72e21f961d214b31f695378fd.tar.bz2 scummvm-rg350-75f7536ca18ce6e72e21f961d214b31f695378fd.zip |
SCI: sierra switched hardcoded inside their pc98 interpreter to font 900, if sjis text got detected
svn-id: r48726
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/graphics/text16.cpp | 28 | ||||
-rw-r--r-- | engines/sci/graphics/text16.h | 3 |
2 files changed, 23 insertions, 8 deletions
diff --git a/engines/sci/graphics/text16.cpp b/engines/sci/graphics/text16.cpp index db73f507f3..e33f5c5d18 100644 --- a/engines/sci/graphics/text16.cpp +++ b/engines/sci/graphics/text16.cpp @@ -262,7 +262,7 @@ void GfxText16::DrawString(const char *str, GuiResourceId orgFontId, int16 orgPe Draw(str, 0, (int16)strlen(str), orgFontId, orgPenColor); } -int16 GfxText16::Size(Common::Rect &rect, const char *str, GuiResourceId fontId, int16 maxWidth) { +int16 GfxText16::Size(Common::Rect &rect, const char *text, GuiResourceId fontId, int16 maxWidth) { GuiResourceId oldFontId = GetFontId(); int16 oldPenColor = _ports->_curPort->penClr; int16 charCount; @@ -271,25 +271,29 @@ int16 GfxText16::Size(Common::Rect &rect, const char *str, GuiResourceId fontId, if (fontId != -1) SetFont(fontId); + + if (g_sci->getLanguage() == Common::JA_JPN) + SwitchToFont900OnSjis(text); + rect.top = rect.left = 0; if (maxWidth < 0) { // force output as single line - StringWidth(str, oldFontId, textWidth, textHeight); + StringWidth(text, oldFontId, textWidth, textHeight); rect.bottom = textHeight; rect.right = textWidth; } else { // rect.right=found widest line with RTextWidth and GetLongest // rect.bottom=num. lines * GetPointSize rect.right = (maxWidth ? maxWidth : 192); - const char*p = str; - while (*p) { - charCount = GetLongest(p, rect.right, oldFontId); + const char *curPos = text; + while (*curPos) { + charCount = GetLongest(curPos, rect.right, oldFontId); if (charCount == 0) break; - Width(p, 0, charCount, oldFontId, textWidth, textHeight); + Width(curPos, 0, charCount, oldFontId, textWidth, textHeight); maxTextWidth = MAX(textWidth, maxTextWidth); totalHeight += textHeight; - p += charCount; + curPos += charCount; } rect.bottom = totalHeight; rect.right = maxWidth ? maxWidth : MIN(rect.right, maxTextWidth); @@ -365,6 +369,9 @@ void GfxText16::Box(const char *text, int16 bshow, const Common::Rect &rect, Tex if (fontId != -1) SetFont(fontId); + if (g_sci->getLanguage() == Common::JA_JPN) + SwitchToFont900OnSjis(text); + while (*text) { charCount = GetLongest(text, rect.width(), orgFontId); if (charCount == 0) @@ -408,4 +415,11 @@ void GfxText16::Draw_String(const char *text) { _ports->penColor(orgPenColor); } +// Sierra did this in their PC98 interpreter only, they identify a text as being sjis and then switch to font 900 +void GfxText16::SwitchToFont900OnSjis(const char *text) { + byte firstChar = (*(const byte *)text++); + if (((firstChar >= 0x81) && (firstChar <= 0x9F)) || ((firstChar >= 0xE0) && (firstChar <= 0xEF))) + SetFont(900); +} + } // End of namespace Sci diff --git a/engines/sci/graphics/text16.h b/engines/sci/graphics/text16.h index e3e526101c..f1ce39f8df 100644 --- a/engines/sci/graphics/text16.h +++ b/engines/sci/graphics/text16.h @@ -59,7 +59,7 @@ public: void StringWidth(const char *str, GuiResourceId orgFontId, int16 &textWidth, int16 &textHeight); void ShowString(const char *str, GuiResourceId orgFontId, int16 orgPenColor); void DrawString(const char *str, GuiResourceId orgFontId, int16 orgPenColor); - int16 Size(Common::Rect &rect, const char *str, GuiResourceId fontId, int16 maxWidth); + int16 Size(Common::Rect &rect, const char *text, GuiResourceId fontId, int16 maxWidth); void Draw(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 orgPenColor); void Show(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 orgPenColor); void Box(const char *text, int16 bshow, const Common::Rect &rect, TextAlignment alignment, GuiResourceId fontId); @@ -69,6 +69,7 @@ public: private: void init(); + void SwitchToFont900OnSjis(const char *text); ResourceManager *_resMan; GfxCache *_cache; |