From 6c828a1c17fc7c98bbd4e565a202fdd91d490369 Mon Sep 17 00:00:00 2001 From: Andrew Kurushin Date: Sat, 19 Nov 2005 12:41:23 +0000 Subject: some Font fixes svn-id: r19668 --- saga/font.cpp | 2 +- saga/font.h | 23 +++++++++++------------ saga/interface.cpp | 6 +++--- saga/sfuncs.cpp | 2 +- 4 files changed, 16 insertions(+), 17 deletions(-) (limited to 'saga') diff --git a/saga/font.cpp b/saga/font.cpp index 30943a7fd7..cdece87007 100644 --- a/saga/font.cpp +++ b/saga/font.cpp @@ -624,7 +624,7 @@ void Font::textDrawRect(FontId fontId, Surface *ds, const char *text, const Comm } } -FontId Font::knownFont2FontIdx(KnownFont font) { +Font::FontId Font::knownFont2FontIdx(KnownFont font) { FontId fontId = kSmallFont; if (_vm->getGameType() == GType_ITE) { diff --git a/saga/font.h b/saga/font.h index c148c6317f..5896060104 100644 --- a/saga/font.h +++ b/saga/font.h @@ -53,16 +53,6 @@ namespace Saga { #define TEXT_MARGIN 10 #define TEXT_LINESPACING 2 -enum FontId { - kSmallFont, - kMediumFont, - kBigFont, - kIHNMUnknown, - kIHNMFont8, - kIHNMUnknown2, - kIHNMMainFont -}; - enum FontEffectFlags { kFontNormal = 0, kFontOutline = 1 << 0, @@ -151,7 +141,17 @@ class Font { } private: - FontId knownFont2FontIdx(KnownFont font); + enum FontId { + kSmallFont, + kMediumFont, + kBigFont, + kIHNMUnknown, + kIHNMFont8, + kIHNMUnknown2, + kIHNMMainFont + }; + + Font::FontId knownFont2FontIdx(KnownFont font); int getStringWidth(FontId fontId, const char *text, size_t count, FontEffectFlags flags); int getHeight(FontId fontId, const char *text, int width, FontEffectFlags flags); @@ -168,7 +168,6 @@ class Font { return _fonts[fontId]; } -public: int getHeight(FontId fontId) { return getFont(fontId)->normal.header.charHeight; } diff --git a/saga/interface.cpp b/saga/interface.cpp index 047e4ca42b..afc94f299e 100644 --- a/saga/interface.cpp +++ b/saga/interface.cpp @@ -780,7 +780,7 @@ void Interface::drawOption() { _optionPanel.calcPanelButtonRect(_optionSaveFilePanel, rect); rect.top++; rect2 = rect; - fontHeight = _vm->_font->getHeight(kSmallFont); + fontHeight = _vm->_font->getHeight(kKnownFontSmall); for (j = 0; j < _vm->getDisplayInfo().optionSaveFileVisible; j++) { bgColor = kITEColorDarkGrey0C; fgColor = kITEColorBrightWhite; @@ -1041,7 +1041,7 @@ void Interface::drawTextInput(Surface *ds, InterfacePanel *panel, PanelButton *p drawButtonBox(ds, rect, kEdit, _textInput); rect.left += 4; rect.top += 4; - rect.setHeight(_vm->_font->getHeight(kSmallFont)); + rect.setHeight(_vm->_font->getHeight(kKnownFontSmall)); i = 0; while ((ch[0] = _textInputString[i++]) != 0) { @@ -1251,7 +1251,7 @@ void Interface::handleOptionClick(const Point& mousePoint) { } else { if (_optionPanel.currentButton == _optionSaveFilePanel) { _optionPanel.calcPanelButtonRect(_optionSaveFilePanel, rect); - _optionSaveFileTitleNumber = (mousePoint.y - rect.top) / (_vm->_font->getHeight(kSmallFont) + 1); + _optionSaveFileTitleNumber = (mousePoint.y - rect.top) / (_vm->_font->getHeight(kKnownFontSmall) + 1); if (_optionSaveFileTitleNumber >= _vm->getDisplayInfo().optionSaveFileVisible) { _optionSaveFileTitleNumber = _vm->getDisplayInfo().optionSaveFileVisible - 1; diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp index e81a8106b1..afa448f195 100644 --- a/saga/sfuncs.cpp +++ b/saga/sfuncs.cpp @@ -1308,7 +1308,7 @@ void Script::sfPlacard(SCRIPTFUNC_PARAMS) { textEntry.color = kITEColorBrightWhite; textEntry.effectColor = kITEColorBlack; textEntry.point.x = _vm->getDisplayWidth() / 2; - textEntry.point.y = (_vm->_scene->getHeight() - _vm->_font->getHeight(kMediumFont)) / 2; + textEntry.point.y = (_vm->_scene->getHeight() - _vm->_font->getHeight(kKnownFontMedium)) / 2; textEntry.font = kKnownFontMedium; textEntry.flags = (FontEffectFlags)(kFontOutline | kFontCentered); textEntry.text = thread->_strings->getString(stringId); -- cgit v1.2.3