mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-24 13:13:58 +00:00
BURIED: Update Japanese font code
This commit is contained in:
parent
a966f157af
commit
1aebefdebb
@ -65,8 +65,11 @@ CompletionWindow::CompletionWindow(BuriedEngine *vm, Window *parent, const Globa
|
||||
|
||||
_timer = setTimer(1000);
|
||||
|
||||
_textFontA = _vm->_gfx->createFont(14);
|
||||
_textFontB = _vm->_gfx->createFont(20, true);
|
||||
_fontHeightA = (_vm->getLanguage() == Common::JA_JPN) ? 12 : 14;
|
||||
_textFontA = _vm->_gfx->createFont(_fontHeightA);
|
||||
|
||||
_fontHeightB = 20;
|
||||
_textFontB = _vm->_gfx->createFont(_fontHeightB, true);
|
||||
|
||||
_walkthroughMode = _globalFlags.generalWalkthroughMode != 0;
|
||||
|
||||
@ -197,24 +200,24 @@ void CompletionWindow::onPaint() {
|
||||
uint32 textColor = _vm->_gfx->getColor(102, 204, 153);
|
||||
Common::String firstBlockText = _vm->getString(2100);
|
||||
Common::Rect firstBlockRect(10, 54, 283, 86);
|
||||
_vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontA, firstBlockText, firstBlockRect.left, firstBlockRect.top, firstBlockRect.width(), textColor, 14);
|
||||
_vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontA, firstBlockText, firstBlockRect.left, firstBlockRect.top, firstBlockRect.width(), textColor, _fontHeightA);
|
||||
|
||||
// Draw the cause text
|
||||
Common::String secondBlockText = _vm->getString(2102);
|
||||
Common::Rect secondBlockRect(10, 120, 283, 215);
|
||||
_vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontA, secondBlockText, secondBlockRect.left, secondBlockRect.top, secondBlockRect.width(), textColor, 14);
|
||||
_vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontA, secondBlockText, secondBlockRect.left, secondBlockRect.top, secondBlockRect.width(), textColor, _fontHeightA);
|
||||
|
||||
// Description text
|
||||
Common::Rect scoringTextRect(10, 248, 283, 378);
|
||||
_vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontA, _scoringTextDescriptions, scoringTextRect.left, scoringTextRect.top, scoringTextRect.width(), textColor, 14);
|
||||
_vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontA, _scoringTextDescriptions, scoringTextRect.left, scoringTextRect.top, scoringTextRect.width(), textColor, _fontHeightA);
|
||||
|
||||
// Scores
|
||||
textColor = _vm->_gfx->getColor(255, 255, 51);
|
||||
_vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontA, _scoringTextScores, scoringTextRect.left, scoringTextRect.top, scoringTextRect.width(), textColor, 14, true);
|
||||
_vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontA, _scoringTextScores, scoringTextRect.left, scoringTextRect.top, scoringTextRect.width(), textColor, _fontHeightA, true);
|
||||
|
||||
// Total score
|
||||
Common::Rect finalScoreRect(122, 386, 283, 401);
|
||||
_vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontB, _scoringTextFinalScore, finalScoreRect.left, finalScoreRect.top, finalScoreRect.width(), textColor, 20, true);
|
||||
_vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontB, _scoringTextFinalScore, finalScoreRect.left, finalScoreRect.top, finalScoreRect.width(), textColor, _fontHeightB, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,6 +57,7 @@ private:
|
||||
GlobalFlags _globalFlags;
|
||||
Graphics::Font *_textFontA;
|
||||
Graphics::Font *_textFontB;
|
||||
int _fontHeightA, _fontHeightB;
|
||||
bool _walkthroughMode;
|
||||
|
||||
Common::String _scoringTextDescriptions;
|
||||
|
@ -108,8 +108,11 @@ DeathWindow::DeathWindow(BuriedEngine *vm, Window *parent, int deathSceneIndex,
|
||||
break;
|
||||
}
|
||||
|
||||
_textFontA = _vm->_gfx->createFont(14);
|
||||
_textFontB = _vm->_gfx->createFont(20, true);
|
||||
_fontHeightA = (_vm->getLanguage() == Common::JA_JPN) ? 12 : 14;
|
||||
_textFontA = _vm->_gfx->createFont(_fontHeightA);
|
||||
|
||||
_fontHeightB = 20;
|
||||
_textFontB = _vm->_gfx->createFont(_fontHeightB, true);
|
||||
|
||||
_walkthroughMode = _globalFlags.generalWalkthroughMode != 0;
|
||||
|
||||
@ -273,21 +276,21 @@ void DeathWindow::onPaint() {
|
||||
uint32 textColor = _vm->_gfx->getColor(153, 102, 204);
|
||||
Common::String firstBlock = _vm->getString(IDS_DEATH_SCENE_MESSAGE_TEXT_BASE + _deathSceneIndex * 5);
|
||||
Common::Rect firstBlockRect(10, 54, 283, 86);
|
||||
_vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontA, firstBlock, firstBlockRect.left, firstBlockRect.top, firstBlockRect.width(), textColor, 14);
|
||||
_vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontA, firstBlock, firstBlockRect.left, firstBlockRect.top, firstBlockRect.width(), textColor, _fontHeightA);
|
||||
|
||||
Common::String secondBlock = _vm->getString(IDS_DEATH_SCENE_MESSAGE_TEXT_BASE + _deathSceneIndex * 5 + 1);
|
||||
Common::Rect secondBlockRect(10, 120, 283, 215);
|
||||
_vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontA, secondBlock, secondBlockRect.left, secondBlockRect.top, secondBlockRect.width(), textColor, 14);
|
||||
_vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontA, secondBlock, secondBlockRect.left, secondBlockRect.top, secondBlockRect.width(), textColor, _fontHeightA);
|
||||
|
||||
Common::Rect scoringDescRect(10, 248, 283, 378);
|
||||
_vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontA, _scoringTextDescriptions, scoringDescRect.left, scoringDescRect.top, scoringDescRect.width(), textColor, 14);
|
||||
_vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontA, _scoringTextDescriptions, scoringDescRect.left, scoringDescRect.top, scoringDescRect.width(), textColor, _fontHeightA);
|
||||
|
||||
textColor = _vm->_gfx->getColor(212, 109, 0);
|
||||
_vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontA, _scoringTextScores, scoringDescRect.left, scoringDescRect.top, scoringDescRect.width(), textColor, 14, true);
|
||||
_vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontA, _scoringTextScores, scoringDescRect.left, scoringDescRect.top, scoringDescRect.width(), textColor, _fontHeightA, true);
|
||||
|
||||
// CHECKME: This does center vertical alignment, so check the y coordinates
|
||||
Common::Rect finalTextScoreRect(122, 386, 283, 401);
|
||||
_vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontB, _scoringTextFinalScore, finalTextScoreRect.left, finalTextScoreRect.top, finalTextScoreRect.width(), textColor, 20, true);
|
||||
_vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontB, _scoringTextFinalScore, finalTextScoreRect.left, finalTextScoreRect.top, finalTextScoreRect.width(), textColor, _fontHeightB, true);
|
||||
}
|
||||
|
||||
bool DeathWindow::onEraseBackground() {
|
||||
|
@ -63,6 +63,7 @@ private:
|
||||
bool _lightOn;
|
||||
Graphics::Font *_textFontA;
|
||||
Graphics::Font *_textFontB;
|
||||
int _fontHeightA, _fontHeightB;
|
||||
bool _walkthroughMode;
|
||||
|
||||
Common::String _scoringTextDescriptions;
|
||||
|
@ -150,12 +150,10 @@ static const uint32 s_codePage1252[256] = {
|
||||
#undef NOT_REQUIRED
|
||||
|
||||
Graphics::Font *GraphicsManager::createFont(int size, bool bold) const {
|
||||
// MS Gothic for the Japanese version (please buy for clone2727)
|
||||
// MS Gothic for the Japanese version
|
||||
// Arial or Arial Bold for everything else
|
||||
if (_vm->getLanguage() == Common::JA_JPN) {
|
||||
assert(!bold);
|
||||
if (_vm->getLanguage() == Common::JA_JPN)
|
||||
return createMSGothicFont(size);
|
||||
}
|
||||
|
||||
return createArialFont(size, bold);
|
||||
}
|
||||
@ -675,13 +673,28 @@ Graphics::Font *GraphicsManager::createMSGothicFont(int size) const {
|
||||
if (!stream)
|
||||
error("Failed to find MS Gothic font");
|
||||
|
||||
// TODO: Map the heights needed to point sizes
|
||||
switch (size) {
|
||||
case 10:
|
||||
size = 7;
|
||||
break;
|
||||
case 11:
|
||||
size = 8;
|
||||
break;
|
||||
case 12:
|
||||
size = 9;
|
||||
break;
|
||||
case 20:
|
||||
size = 16;
|
||||
break;
|
||||
default:
|
||||
error("Unknown MS Gothic font size %d", size);
|
||||
}
|
||||
|
||||
// TODO: Make the monochrome mode optional
|
||||
// Win3.1 obviously only had raster fonts, but BIT Win3.1 will render
|
||||
// with the TrueType font on Win7/Win8 (at least)
|
||||
// TODO: shift-jis codepage (932) and mapping
|
||||
Graphics::Font *font = Graphics::loadTTFFont(*stream, size, 96, !_vm->isTrueColor(), s_codePage1252);
|
||||
Graphics::Font *font = Graphics::loadTTFFont(*stream, size, 96, _vm->isTrueColor() ? Graphics::kTTFRenderModeLight : Graphics::kTTFRenderModeMonochrome, s_codePage1252);
|
||||
|
||||
if (!font)
|
||||
error("Failed to load MS Gothic font");
|
||||
|
@ -41,7 +41,9 @@ InventoryInfoWindow::InventoryInfoWindow(BuriedEngine *vm, Window *parent, int c
|
||||
_spinStart = 0;
|
||||
_spinLength = 70;
|
||||
|
||||
_textFont = _vm->_gfx->createFont(14);
|
||||
_fontHeight = (_vm->getLanguage() == Common::JA_JPN) ? 11 : 14;
|
||||
_textFont = _vm->_gfx->createFont(_fontHeight);
|
||||
|
||||
_rect = Common::Rect(0, 0, 432, 189);
|
||||
_videoWindow = new VideoWindow(_vm, this);
|
||||
|
||||
|
@ -52,6 +52,7 @@ public:
|
||||
|
||||
private:
|
||||
Graphics::Font *_textFont;
|
||||
int _fontHeight;
|
||||
int _currentItemID;
|
||||
VideoWindow *_videoWindow;
|
||||
int32 _spinStart;
|
||||
|
@ -75,7 +75,8 @@ InventoryWindow::InventoryWindow(BuriedEngine *vm, Window *parent) : Window(vm,
|
||||
|
||||
rebuildPreBuffer();
|
||||
|
||||
_textFont = _vm->_gfx->createFont(14);
|
||||
_fontHeight = (_vm->getLanguage() == Common::JA_JPN) ? 10 : 14;
|
||||
_textFont = _vm->_gfx->createFont(_fontHeight);
|
||||
|
||||
_rect = Common::Rect(182, 375, 450, 454);
|
||||
_curCursor = (int)kCursorNone;
|
||||
@ -263,6 +264,13 @@ void InventoryWindow::onPaint() {
|
||||
for (int i = -2; i < 3; i++) {
|
||||
if ((i + _curItem) >= 0 && (i + _curItem) < (int)_itemArray.size()) {
|
||||
Common::Rect textRect = Common::Rect(120, (i + 2) * 13 + 8, 254, (i + 3) * 13 + 8);
|
||||
|
||||
if (_vm->getLanguage() == Common::JA_JPN) {
|
||||
// Japanese version is shifted by one pixel
|
||||
textRect.top++;
|
||||
textRect.bottom++;
|
||||
}
|
||||
|
||||
textRect.translate(absoluteRect.left, absoluteRect.top);
|
||||
Common::String text = _vm->getString(IDES_ITEM_TITLE_BASE + _itemArray[_curItem + i]);
|
||||
_textFont->drawString(_vm->_gfx->getScreen(), text, textRect.left, textRect.top, textRect.width(), textColor);
|
||||
|
@ -71,6 +71,7 @@ public:
|
||||
|
||||
private:
|
||||
Graphics::Font *_textFont;
|
||||
int _fontHeight;
|
||||
Graphics::Surface *_background;
|
||||
Common::Array<int> _itemArray;
|
||||
int _curItem;
|
||||
|
@ -39,7 +39,8 @@ LiveTextWindow::LiveTextWindow(BuriedEngine *vm, Window *parent) : Window(vm, pa
|
||||
_textTranslation = false;
|
||||
|
||||
// Create font
|
||||
_font = _vm->_gfx->createFont(14);
|
||||
_fontHeight = (_vm->getLanguage() == Common::JA_JPN) ? 12 : 14;
|
||||
_font = _vm->_gfx->createFont(_fontHeight);
|
||||
|
||||
// Create window
|
||||
_rect = Common::Rect(137, 21, 447, 87);
|
||||
@ -115,7 +116,7 @@ void LiveTextWindow::onPaint() {
|
||||
|
||||
// Draw the text on top of that
|
||||
if (!_text.empty())
|
||||
_vm->_gfx->renderText(surface, _font, _text, 30, 4, 270, _vm->_gfx->getColor(212, 109, 0), 14);
|
||||
_vm->_gfx->renderText(surface, _font, _text, 30, 4, 270, _vm->_gfx->getColor(212, 109, 0), _fontHeight);
|
||||
|
||||
Common::Rect absoluteRect = getAbsoluteRect();
|
||||
_vm->_gfx->blit(surface, absoluteRect.left, absoluteRect.top);
|
||||
|
@ -51,6 +51,7 @@ public:
|
||||
|
||||
private:
|
||||
Graphics::Font *_font;
|
||||
int _fontHeight;
|
||||
bool _textTranslation;
|
||||
Common::String _text;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user