[Scummvm-git-logs] scummvm master -> aecafd473cbb0f7424567b5cac9738b56187aa48
stevenhoefel
stevenhoefel at hotmail.com
Sat Jan 14 05:03:10 CET 2017
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
aecafd473c DIRECTOR: Load fonts by name if exists from map.
Commit: aecafd473cbb0f7424567b5cac9738b56187aa48
https://github.com/scummvm/scummvm/commit/aecafd473cbb0f7424567b5cac9738b56187aa48
Author: stevenhoefel (stevenhoefel at hotmail.com)
Date: 2017-01-14T15:02:58+11:00
Commit Message:
DIRECTOR: Load fonts by name if exists from map.
Changed paths:
engines/director/frame.cpp
graphics/macgui/macfontmanager.cpp
graphics/macgui/macfontmanager.h
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index eeecc0f..7e7180b 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -880,14 +880,14 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo
int width = _sprites[spriteId]->_width;
if (_vm->getVersion() >= 4 && !isButtonLabel) width = textCast->initialRect.right;
- Graphics::MacFont macFont(textCast->fontId, textCast->fontSize, textCast->textSlant);
-
if (_vm->_currentScore->_fontMap.contains(textCast->fontId)) {
- // Override
- //macFont.setName(_vm->_currentScore->_fontMap[textCast->fontId]);
- //TODO: this still needs to take font style and size into account!
+ // We need to make sure that teh Shared Cast fonts have been loaded in?
+ //might need a mapping table here of our own.
+ textCast->fontId = _vm->_wm->_fontMan->getFontIdByName(_vm->_currentScore->_fontMap[textCast->fontId]);
}
+ Graphics::MacFont macFont = Graphics::MacFont(textCast->fontId, textCast->fontSize, textCast->textSlant);
+
const Graphics::Font *font = _vm->_wm->_fontMan->getFont(macFont);
height = font->getFontHeight();
@@ -917,19 +917,14 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo
width += padding * 2;
height += padding;
- if (textCast->textAlign == kTextAlignLeft)
- textX += padding;
- else if (textCast->textAlign == kTextAlignRight)
- textX -= padding;
-
+ if (textCast->textAlign == kTextAlignLeft) textX += padding;
+ else if (textCast->textAlign == kTextAlignRight) textX -= padding;
//TODO: alignment issue with odd-size-width center-aligned text
//else if (textCast->textAlign == kTextAlignCenter && ((borderSize + padding) % 2 == 1)) textX--;
-
textY += padding / 2;
}
- if (textCast->textAlign == kTextAlignRight)
- textX -= 1;
+ if (textCast->textAlign == kTextAlignRight) textX -= 1;
if (textShadow > 0) {
if (borderSize == 0 && _vm->getVersion() > 3)
diff --git a/graphics/macgui/macfontmanager.cpp b/graphics/macgui/macfontmanager.cpp
index 21f9c08..c6e8d7e 100644
--- a/graphics/macgui/macfontmanager.cpp
+++ b/graphics/macgui/macfontmanager.cpp
@@ -207,6 +207,13 @@ const char *MacFontManager::getFontName(MacFont &font) {
return getFontName(font.getId(), font.getSize(), font.getSlant());
}
+int MacFontManager::getFontIdByName(Common::String name) {
+ for (int f = 0; f < ARRAYSIZE(fontNames); f++)
+ if (fontNames[f] != NULL && strcmp(fontNames[f], name.c_str()) == 0)
+ return f;
+ return 1;
+}
+
void MacFontManager::generateFontSubstitute(MacFont &macFont) {
Common::String name;
diff --git a/graphics/macgui/macfontmanager.h b/graphics/macgui/macfontmanager.h
index 61c050b..c098d79 100644
--- a/graphics/macgui/macfontmanager.h
+++ b/graphics/macgui/macfontmanager.h
@@ -118,6 +118,7 @@ public:
*/
const char *getFontName(int id, int size, int slant = kMacFontRegular);
const char *getFontName(MacFont &font);
+ int getFontIdByName(Common::String name);
private:
void loadFonts();
More information about the Scummvm-git-logs
mailing list