[Scummvm-git-logs] scummvm master -> 75116de75f129cf6a0535f64dabf2f36af9094f2
athrxx
athrxx at scummvm.org
Fri Oct 30 20:46:44 UTC 2020
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
fb834e55fb SCUMM: (CJK) - proper display of the pause/restart dialogs
5b6ffeaa3d GUI: allow ingame CJK dialogs regardless of the launcher language
59c5980d42 SCUMM: (CJK) - change Korean Ansi codepage name
86040f13b8 WIN32: add some CJK codepage name mappings
75116de75f NEWS: mention SCUMM CJK fixes
Commit: fb834e55fb603d3c13d5ecd459668a7a4356c800
https://github.com/scummvm/scummvm/commit/fb834e55fb603d3c13d5ecd459668a7a4356c800
Author: athrxx (athrxx at scummvm.org)
Date: 2020-10-30T21:36:19+01:00
Commit Message:
SCUMM: (CJK) - proper display of the pause/restart dialogs
This is yet incomplete, since it requires the launcher to be configured in the exact same language as the game (e. g. launcher must be set to Japanese for Japanese FM-Towns games or the pause/restart dialog will be empty). This will be fixed in an extra commit.
Changed paths:
engines/scumm/dialogs.cpp
diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp
index 4a4ba0bd15..e29367834a 100644
--- a/engines/scumm/dialogs.cpp
+++ b/engines/scumm/dialogs.cpp
@@ -21,6 +21,7 @@
*/
#include "common/config-manager.h"
+#include "common/encoding.h"
#include "common/savefile.h"
#include "common/system.h"
#include "common/events.h"
@@ -458,7 +459,16 @@ const Common::U32String InfoDialog::queryResString(int stringno) {
tmp += chr;
}
}
- return _(tmp);
+
+ Common::String convertFromCodePage;
+ if (_vm->_language == Common::KO_KOR)
+ convertFromCodePage = "ks_c_5601-1987";
+ else if (_vm->_language == Common::JA_JPN)
+ convertFromCodePage = "shift_jis";
+ else if (_vm->_language == Common::ZH_TWN || _vm->_language == Common::ZH_CNA)
+ convertFromCodePage = "big5";
+
+ return convertFromCodePage.empty() ? _(tmp) : U32String((const Common::U32String::value_type*)Common::Encoding::convert("utf-32", convertFromCodePage, tmp));
}
#pragma mark -
Commit: 5b6ffeaa3ddbe31d15b90b225c0acce98b804903
https://github.com/scummvm/scummvm/commit/5b6ffeaa3ddbe31d15b90b225c0acce98b804903
Author: athrxx (athrxx at scummvm.org)
Date: 2020-10-30T21:36:23+01:00
Commit Message:
GUI: allow ingame CJK dialogs regardless of the launcher language
This allows a text widget to be expressly marked as Japanese, Korean or Chinese, so that the theme engine may use an appropriate font.
Changed paths:
engines/scumm/dialogs.cpp
engines/scumm/dialogs.h
gui/ThemeEngine.cpp
gui/ThemeEngine.h
gui/ThemeParser.cpp
gui/widget.cpp
gui/widget.h
diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp
index e29367834a..50b8f15b4a 100644
--- a/engines/scumm/dialogs.cpp
+++ b/engines/scumm/dialogs.cpp
@@ -382,16 +382,23 @@ void HelpDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 da
#pragma mark -
InfoDialog::InfoDialog(ScummEngine *scumm, int res)
-: ScummDialog(0, 0, 0, 0), _vm(scumm) { // dummy x and w
+: ScummDialog(0, 0, 0, 0), _vm(scumm), _style(GUI::ThemeEngine::kFontStyleBold) { // dummy x and w
_message = queryResString(res);
+ Common::Language lang = (_vm->_language == Common::KO_KOR || _vm->_language == Common::JA_JPN ||
+ _vm->_language == Common::ZH_TWN || _vm->_language == Common::ZH_CNA) ? _vm->_language : Common::UNK_LANG;
+
// Width and height are dummy
- _text = new GUI::StaticTextWidget(this, 0, 0, 10, 10, _message, kTextAlignCenter);
+ _text = new GUI::StaticTextWidget(this, 0, 0, 10, 10, _message, kTextAlignCenter, Common::U32String(), GUI::ThemeEngine::kFontStyleBold, lang);
+
+ // Store this for the calls to getStringWidth() and getStringHeight() in reflowLayout().
+ if (lang != Common::UNK_LANG)
+ _style = GUI::ThemeEngine::kFontStyleLangExtra;
}
InfoDialog::InfoDialog(ScummEngine *scumm, const U32String &message)
-: ScummDialog(0, 0, 0, 0), _vm(scumm) { // dummy x and w
+: ScummDialog(0, 0, 0, 0), _vm(scumm), _style(GUI::ThemeEngine::kFontStyleBold) { // dummy x and w
_message = message;
@@ -409,8 +416,8 @@ void InfoDialog::reflowLayout() {
const int screenW = g_system->getOverlayWidth();
const int screenH = g_system->getOverlayHeight();
- int width = g_gui.getStringWidth(_message) + 16;
- int height = g_gui.getFontHeight() + 8;
+ int width = g_gui.getStringWidth(_message, _style) + 16;
+ int height = g_gui.getFontHeight(_style) + 8;
_w = width;
_h = height;
diff --git a/engines/scumm/dialogs.h b/engines/scumm/dialogs.h
index d5185a05b5..f8566c0a4f 100644
--- a/engines/scumm/dialogs.h
+++ b/engines/scumm/dialogs.h
@@ -72,6 +72,7 @@ protected:
ScummEngine *_vm;
U32String _message;
GUI::StaticTextWidget *_text;
+ GUI::ThemeEngine::FontStyle _style;
public:
// arbitrary message
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index c4d5789cb8..6688d2b515 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -553,7 +553,7 @@ bool ThemeEngine::addFont(TextData textId, const Common::String &language, const
Common::String localized = FontMan.genLocalizedFontFilename(file);
const Common::String charset
#ifdef USE_TRANSLATION
- (TransMan.getCurrentCharset())
+ (textId == kTextDataExtraLang ? "" : TransMan.getCurrentCharset())
#endif
;
@@ -598,6 +598,63 @@ bool ThemeEngine::addFont(TextData textId, const Common::String &language, const
}
+// This should work independently of the translation manager, since it is is just about displaying
+// correct ingame messages in Chinese, Korean and Japanese games, even if the launcher is set to
+// English and/or the translations are disabled.
+Common::Array<Common::Language> getLangIdentifiers(const Common::String &language) {
+ struct IdStr2Lang {
+ const char strId[6];
+ Common::Language lang;
+ };
+
+ // I have added only the languages that currently make sense (the only other extra font that we
+ // currently have is for Hindi, but that language is only supported in the launcher, there are
+ // no games in Hindi).
+ IdStr2Lang matchPairs[] = {
+ // { "hi", Common::UNK_LANG },
+ { "ja", Common::JA_JPN },
+ { "ko", Common::KO_KOR },
+ { "zh", Common::ZH_ANY },
+ { "zh", Common::ZH_CNA },
+ { "zh", Common::ZH_TWN }
+ };
+
+ Common::Array<Common::Language> result;
+
+ for (int i = 0; i < ARRAYSIZE(matchPairs); ++i) {
+ if (language.contains(matchPairs[i].strId))
+ result.push_back(matchPairs[i].lang);
+ }
+
+ return result;
+}
+
+void ThemeEngine::storeFontNames(TextData textId, const Common::String &language, const Common::String &file, const Common::String &scalableFile, const int pointsize) {
+ if (language.empty())
+ return;
+
+ Common::Array<Common::Language> langs = getLangIdentifiers(language);
+ if (langs.empty())
+ return;
+
+ Common::Array<LangExtraFont>::iterator entry = Common::find(_langExtraFonts.begin(), _langExtraFonts.end(), langs[0]);
+ if (entry == _langExtraFonts.end())
+ _langExtraFonts.push_back(LangExtraFont(textId, langs, file, scalableFile, pointsize));
+ else
+ entry->storeFileNames(textId, file, scalableFile, pointsize);
+}
+
+bool ThemeEngine::loadExtraFont(FontStyle style, Common::Language lang) {
+ if (style >= kFontStyleMax)
+ return false;
+
+ Common::Array<LangExtraFont>::iterator entry = Common::find(_langExtraFonts.begin(), _langExtraFonts.end(), lang);
+ if (entry == _langExtraFonts.end())
+ return false;
+ TextData td = fontStyleToData(style);
+ return addFont(GUI::TextData::kTextDataExtraLang, Common::String(), entry->file(td), entry->sclFile(td), entry->fntSize(td));
+}
+
bool ThemeEngine::addTextColor(TextColor colorId, int r, int g, int b) {
if (colorId >= kTextColorMAX)
return false;
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index 32492a8e31..87acb61eec 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -27,6 +27,7 @@
#include "common/fs.h"
#include "common/hash-str.h"
#include "common/hashmap.h"
+#include "common/language.h"
#include "common/list.h"
#include "common/str.h"
#include "common/rect.h"
@@ -151,6 +152,7 @@ enum TextData {
kTextDataNormalFont,
kTextDataTooltip,
kTextDataConsole,
+ kTextDataExtraLang,
kTextDataMAX
};
@@ -169,6 +171,34 @@ enum TextColor {
kTextColorMAX
};
+class LangExtraFont {
+public:
+ LangExtraFont(TextData textId, Common::Array<Common::Language> &lngs, const Common::String &file, const Common::String &scalableFile, int ps) : _langs(lngs) {
+ storeFileNames(textId, file, scalableFile, ps);
+ }
+
+ void storeFileNames(TextData textId, const Common::String &file, const Common::String &scalableFile, int ps) {
+ assert(textId < kTextDataMAX);
+ _fontFilesStd[textId] = file;
+ _fontFilesScalable[textId] = scalableFile;
+ _fontSize[textId] = ps;
+ }
+
+ bool operator==(Common::Language l) const {
+ return (Common::find(_langs.begin(), _langs.end(), l) != _langs.end());
+ }
+
+ Common::String file(TextData textId) const { return _fontFilesStd[textId]; }
+ Common::String sclFile(TextData textId) const { return _fontFilesScalable[textId]; }
+ int fntSize(TextData textId) const { return _fontSize[textId]; }
+
+private:
+ Common::Array<Common::Language> _langs;
+ Common::String _fontFilesStd[kTextDataMAX];
+ Common::String _fontFilesScalable[kTextDataMAX];
+ int _fontSize[kTextDataMAX];
+};
+
class ThemeEngine {
protected:
typedef Common::HashMap<Common::String, Graphics::Surface *> ImagesMap;
@@ -241,6 +271,7 @@ public:
kFontStyleFixedItalic = 5, ///< Fixed size italic font.
kFontStyleTooltip = 6, ///< Tiny console font
kFontStyleConsole = 7, ///< Debug console font
+ kFontStyleLangExtra = 8, ///< Language specific font for ingame dialogs (e. g. the SCUMM pause/restart dialogs)
kFontStyleMax
};
@@ -380,6 +411,8 @@ public:
return kTextDataTooltip;
if (font == kFontStyleConsole)
return kTextDataConsole;
+ if (font == kFontStyleLangExtra)
+ return kTextDataExtraLang;
return kTextDataDefault;
}
@@ -520,6 +553,22 @@ public:
*/
bool addFont(TextData textId, const Common::String &language, const Common::String &file, const Common::String &scalableFile, const int pointsize);
+ /**
+ * Store language specific font names for ingame GUI dialogs which might require
+ * a different language than the current GUI setting
+ *
+ * @param textId, language, file, scalableFile, pointsize All exactly the same as with addFont()
+ */
+ void storeFontNames(TextData textId, const Common::String &language, const Common::String &file, const Common::String &scalableFile, const int pointsize);
+
+ /**
+ * Load language specific font for ingame use
+ * @param style font style associated with the font file
+ * @param lang language associated with the font file
+ * @return
+ */
+ bool loadExtraFont(FontStyle style, Common::Language lang);
+
/**
* Interface for the ThemeParser class: adds a text color value.
*
@@ -741,6 +790,11 @@ protected:
/** Array of all font colors available. */
TextColorData *_textColors[kTextColorMAX];
+ /** Extra font file names for languages like Japanese, Korean or Chinese
+ * for use in ingame dialogs (like the SCUMM pause/restart dialogs)
+ */
+ Common::Array<LangExtraFont> _langExtraFonts;
+
ImagesMap _bitmaps;
AImagesMap _abitmaps;
Graphics::PixelFormat _overlayFormat;
diff --git a/gui/ThemeParser.cpp b/gui/ThemeParser.cpp
index 020e1091c4..95c7040973 100644
--- a/gui/ThemeParser.cpp
+++ b/gui/ThemeParser.cpp
@@ -222,6 +222,9 @@ bool ThemeParser::parserCallback_language(ParserNode *node) {
scalableFile = getParentNode(node)->values["scalable_file"];
}
+
+ _theme->storeFontNames(textDataId, node->values["id"], file, scalableFile, pointsize);
+
if (!_theme->addFont(textDataId, node->values["id"], file, scalableFile, pointsize))
return parserError("Error loading localized Font in theme engine.");
diff --git a/gui/widget.cpp b/gui/widget.cpp
index da2f8406d9..62be5d6061 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -293,24 +293,22 @@ void Widget::read(const Common::U32String &str) {
#pragma mark -
-StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &text, Graphics::TextAlign align, const Common::U32String &tooltip, ThemeEngine::FontStyle font)
+StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &text, Graphics::TextAlign align, const Common::U32String &tooltip, ThemeEngine::FontStyle font, Common::Language lang)
: Widget(boss, x, y, w, h, tooltip) {
setFlags(WIDGET_ENABLED);
_type = kStaticTextWidget;
_label = text;
- _font = font;
_align = Graphics::convertTextAlignH(align, g_gui.useRTL() && _useRTL);
+ setFont(font, lang);
}
-StaticTextWidget::StaticTextWidget(GuiObject *boss, const Common::String &name, const Common::U32String &text, const Common::U32String &tooltip, ThemeEngine::FontStyle font)
+StaticTextWidget::StaticTextWidget(GuiObject *boss, const Common::String &name, const Common::U32String &text, const Common::U32String &tooltip, ThemeEngine::FontStyle font, Common::Language lang)
: Widget(boss, name, tooltip) {
setFlags(WIDGET_ENABLED | WIDGET_CLEARBG);
_type = kStaticTextWidget;
_label = text;
-
_align = Graphics::convertTextAlignH(g_gui.xmlEval()->getWidgetTextHAlign(name), g_gui.useRTL() && _useRTL);
-
- _font = font;
+ setFont(font, lang);
}
void StaticTextWidget::setValue(int value) {
@@ -342,6 +340,16 @@ void StaticTextWidget::drawWidget() {
);
}
+void StaticTextWidget::setFont(ThemeEngine::FontStyle font, Common::Language lang) {
+ _font = font;
+
+ if (lang == Common::UNK_LANG)
+ return;
+
+ if (g_gui.theme()->loadExtraFont(font, lang))
+ _font = GUI::ThemeEngine::kFontStyleLangExtra;
+}
+
#pragma mark -
ButtonWidget::ButtonWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &label, const Common::U32String &tooltip, uint32 cmd, uint8 hotkey)
diff --git a/gui/widget.h b/gui/widget.h
index 9c4810df39..865ec3933b 100644
--- a/gui/widget.h
+++ b/gui/widget.h
@@ -200,9 +200,10 @@ protected:
Common::U32String _label;
Graphics::TextAlign _align;
ThemeEngine::FontStyle _font;
+
public:
- StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &text, Graphics::TextAlign align, const Common::U32String &tooltip = Common::U32String(""), ThemeEngine::FontStyle font = ThemeEngine::kFontStyleBold);
- StaticTextWidget(GuiObject *boss, const Common::String &name, const Common::U32String &text, const Common::U32String &tooltip = Common::U32String(""), ThemeEngine::FontStyle font = ThemeEngine::kFontStyleBold);
+ StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &text, Graphics::TextAlign align, const Common::U32String &tooltip = Common::U32String(""), ThemeEngine::FontStyle font = ThemeEngine::kFontStyleBold, Common::Language lang = Common::UNK_LANG);
+ StaticTextWidget(GuiObject *boss, const Common::String &name, const Common::U32String &text, const Common::U32String &tooltip = Common::U32String(""), ThemeEngine::FontStyle font = ThemeEngine::kFontStyleBold, Common::Language lang = Common::UNK_LANG);
void setValue(int value);
void setLabel(const Common::U32String &label);
void handleMouseEntered(int button) override { readLabel(); }
@@ -213,6 +214,7 @@ public:
protected:
void drawWidget() override;
+ void setFont(ThemeEngine::FontStyle font, Common::Language lang);
};
/* ButtonWidget */
Commit: 59c5980d42612e9059be39b39162d0c8db6918f2
https://github.com/scummvm/scummvm/commit/59c5980d42612e9059be39b39162d0c8db6918f2
Author: athrxx (athrxx at scummvm.org)
Date: 2020-10-30T21:36:27+01:00
Commit Message:
SCUMM: (CJK) - change Korean Ansi codepage name
(use iconv name instead of .NET name)
Changed paths:
engines/scumm/dialogs.cpp
diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp
index 50b8f15b4a..583a30060d 100644
--- a/engines/scumm/dialogs.cpp
+++ b/engines/scumm/dialogs.cpp
@@ -469,7 +469,7 @@ const Common::U32String InfoDialog::queryResString(int stringno) {
Common::String convertFromCodePage;
if (_vm->_language == Common::KO_KOR)
- convertFromCodePage = "ks_c_5601-1987";
+ convertFromCodePage = "cp949";
else if (_vm->_language == Common::JA_JPN)
convertFromCodePage = "shift_jis";
else if (_vm->_language == Common::ZH_TWN || _vm->_language == Common::ZH_CNA)
Commit: 86040f13b8e27b45d6a8918805f4cf546b6b3c7b
https://github.com/scummvm/scummvm/commit/86040f13b8e27b45d6a8918805f4cf546b6b3c7b
Author: athrxx (athrxx at scummvm.org)
Date: 2020-10-30T21:36:29+01:00
Commit Message:
WIN32: add some CJK codepage name mappings
Changed paths:
backends/platform/sdl/win32/codepage.h
diff --git a/backends/platform/sdl/win32/codepage.h b/backends/platform/sdl/win32/codepage.h
index b6454005e6..6048f34fe1 100644
--- a/backends/platform/sdl/win32/codepage.h
+++ b/backends/platform/sdl/win32/codepage.h
@@ -63,9 +63,13 @@ const CodePageDescription g_cpDescriptions[] = {
{"windows-874", 874}, //ANSI/OEM Thai (ISO 8859-11); Thai (Windows)
{"cp875", 875}, //IBM EBCDIC Greek Modern
{"shift_jis", 932}, //ANSI/OEM Japanese; Japanese (Shift-JIS)
+ {"cp932", 932}, //ANSI/OEM Japanese; Japanese (Shift-JIS)
{"gb2312", 936}, //ANSI/OEM Simplified Chinese (PRC, Singapore); Chinese Simplified (GB2312)
{"ks_c_5601-1987", 949}, //ANSI/OEM Korean (Unified Hangul Code)
+ {"cp949", 949}, //ANSI/OEM Korean (Unified Hangul Code)
+ {"uhc", 949}, //ANSI/OEM Korean (Unified Hangul Code)
{"big5", 950}, //ANSI/OEM Traditional Chinese (Taiwan; Hong Kong SAR, PRC); Chinese Traditional (Big5)
+ {"cp950", 950}, //ANSI/OEM Traditional Chinese (Taiwan; Hong Kong SAR, PRC); Chinese Traditional (Big5)
{"ibm1026", 1026}, //IBM EBCDIC Turkish (Latin 5)
{"ibm01047", 1047}, //IBM EBCDIC Latin 1/Open System
{"ibm01140", 1140}, //IBM EBCDIC US-Canada (037 + Euro symbol); IBM EBCDIC (US-Canada-Euro)
@@ -188,7 +192,7 @@ const CodePageDescription g_cpDescriptions[] = {
{"x-iscii-gu", 57010}, //ISCII Gujarati
{"x-iscii-pa", 57011}, //ISCII Punjabi
{"utf-7", 65000}, //Unicode (UTF-7)
- {"utf-8", 65001}, //Unicode (UTF-8)
+ {"utf-8", 65001}, //Unicode (UTF-8)
{nullptr, 0} //End
};
Commit: 75116de75f129cf6a0535f64dabf2f36af9094f2
https://github.com/scummvm/scummvm/commit/75116de75f129cf6a0535f64dabf2f36af9094f2
Author: athrxx (athrxx at scummvm.org)
Date: 2020-10-30T21:36:32+01:00
Commit Message:
NEWS: mention SCUMM CJK fixes
Changed paths:
NEWS.md
diff --git a/NEWS.md b/NEWS.md
index 6fce3f671d..f1ac5580d4 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -42,6 +42,11 @@ For a more comprehensive changelog of the latest experimental code, see:
- Added RGB rendering mode (16/32bpp) for SCI0 - SCI1.1 games, which addresses palette
issues in screen transitions and avoids mode changes when playing Mac QuickTime videos.
+SCUMM:
+ - Fixed Chinese, Japanese and Korean text display for The Dig and for The Curse of Monkey Island. These fixes
+ also include some improvements to the common text display (mainly the formatting of wrapped texts).
+ - Fixed display of Chinese, Japanese and Korean pause and restart dialogs.
+
Tinsel:
- Enabled the Return to Launcher feature.
More information about the Scummvm-git-logs
mailing list