[Scummvm-git-logs] scummvm master -> d8c8b78afa49fcae610d5ee112d41b5af9f29957
sev-
sev at scummvm.org
Fri Jan 27 19:36:56 CET 2017
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
c29bb1b672 JANITORIAL: Whitespace fixes
fae09e9343 GRAPHICS: Added additional font map registering to MacFontManager
d8c8b78afa DIRECTOR: Register and use additional fonts
Commit: c29bb1b6722b4f254ecc489c0cffd20b1418902e
https://github.com/scummvm/scummvm/commit/c29bb1b6722b4f254ecc489c0cffd20b1418902e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-01-27T18:47:10+01:00
Commit Message:
JANITORIAL: Whitespace fixes
Changed paths:
engines/director/frame.cpp
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index 1dce311..68c7cdd 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -911,7 +911,7 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo
textY += padding / 2;
}
- if (textCast->textAlign == kTextAlignRight)
+ if (textCast->textAlign == kTextAlignRight)
textX -= 1;
if (textShadow > 0)
@@ -950,7 +950,7 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo
textWithFeatures.transBlitFrom(textSurface->rawSurface(), Common::Point(textX + textShadow, textY + textShadow), 0xff);
textWithFeatures.transBlitFrom(textSurface->rawSurface(), Common::Point(textX, textY), 0xff);
-
+
inkBasedBlit(surface, textWithFeatures, spriteId, Common::Rect(x, y, x + width, y + height));
}
Commit: fae09e93430afff6170282a72a794a09d6ecb913
https://github.com/scummvm/scummvm/commit/fae09e93430afff6170282a72a794a09d6ecb913
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-01-27T19:02:37+01:00
Commit Message:
GRAPHICS: Added additional font map registering to MacFontManager
Changed paths:
graphics/macgui/macfontmanager.cpp
graphics/macgui/macfontmanager.h
diff --git a/graphics/macgui/macfontmanager.cpp b/graphics/macgui/macfontmanager.cpp
index 1b664d5..08b225a 100644
--- a/graphics/macgui/macfontmanager.cpp
+++ b/graphics/macgui/macfontmanager.cpp
@@ -77,7 +77,7 @@ static const char *const fontNames[] = {
MacFontManager::MacFontManager() {
for (uint i = 0; i < ARRAYSIZE(fontNames); i++)
if (fontNames[i])
- _fontNames.setVal(fontNames[i], i);
+ _fontIds.setVal(fontNames[i], i);
loadFonts();
}
@@ -110,7 +110,7 @@ void MacFontManager::loadFontsBDF() {
if (font->getFamilyName() && *font->getFamilyName()) {
fontName = Common::String::format("%s-%s-%d", font->getFamilyName(), font->getFontSlant(), font->getFontSize());
- macfont = new MacFont(_fontNames.getVal(font->getFamilyName(), kMacFontNonStandard), font->getFontSize(), parseFontSlant(font->getFontSlant()));
+ macfont = new MacFont(_fontIds.getVal(font->getFamilyName(), kMacFontNonStandard), font->getFontSize(), parseFontSlant(font->getFontSlant()));
} else { // Get it from the file name
fontName = (*it)->getName();
@@ -223,7 +223,7 @@ void MacFontManager::loadFonts(Common::MacResManager *fontFile) {
Common::String fontName = Common::String::format("%s-%d-%d", familyName.c_str(), (*assoc)[i]._fontStyle, (*assoc)[i]._fontSize);
- macfont = new MacFont(_fontNames.getVal(familyName, kMacFontNonStandard), (*assoc)[i]._fontSize, (*assoc)[i]._fontStyle);
+ macfont = new MacFont(_fontIds.getVal(familyName, kMacFontNonStandard), (*assoc)[i]._fontSize, (*assoc)[i]._fontStyle);
FontMan.assignFontToName(fontName, font);
macfont->setFont(font);
@@ -276,13 +276,28 @@ int MacFontManager::parseFontSlant(Common::String slant) {
return slantVal;
}
+void MacFontManager::registerFontMapping(uint16 id, Common::String name) {
+ _extraFontNames[id] = name;
+ _extraFontIds[name] = id;
+}
+
+void MacFontManager::clearFontMapping() {
+ _extraFontNames.clear();
+ _extraFontIds.clear();
+}
+
const char *MacFontManager::getFontName(int id, int size, int slant) {
static char name[128];
+ Common::String n;
- if (id > ARRAYSIZE(fontNames))
+ if (_extraFontNames.contains(id))
+ n = _extraFontNames[id];
+ else if (id < ARRAYSIZE(fontNames))
+ n = fontNames[id];
+ else
return NULL;
- snprintf(name, 128, "%s-%d-%d", fontNames[id], slant, size);
+ snprintf(name, 128, "%s-%d-%d", n.c_str(), slant, size);
return name;
}
@@ -292,6 +307,9 @@ const char *MacFontManager::getFontName(MacFont &font) {
}
int MacFontManager::getFontIdByName(Common::String name) {
+ if (_extraFontIds.contains(name))
+ return _extraFontIds[name];
+
for (int f = 0; f < ARRAYSIZE(fontNames); f++)
if (fontNames[f] != NULL && strcmp(fontNames[f], name.c_str()) == 0)
return f;
diff --git a/graphics/macgui/macfontmanager.h b/graphics/macgui/macfontmanager.h
index 2743f8b..07407e2 100644
--- a/graphics/macgui/macfontmanager.h
+++ b/graphics/macgui/macfontmanager.h
@@ -131,6 +131,9 @@ public:
void loadFonts(const Common::String &fileName);
void loadFonts(Common::MacResManager *fontFile);
+ void registerFontMapping(uint16 id, Common::String name);
+ void clearFontMapping();
+
private:
void loadFontsBDF();
void loadFonts();
@@ -142,7 +145,10 @@ private:
bool _builtInFonts;
Common::HashMap<Common::String, MacFont *> _fontRegistry;
- Common::HashMap<Common::String, int> _fontNames;
+ Common::HashMap<Common::String, int> _fontIds;
+
+ Common::HashMap<uint16, Common::String> _extraFontNames;
+ Common::HashMap<Common::String, int> _extraFontIds;
int parseFontSlant(Common::String slant);
};
Commit: d8c8b78afa49fcae610d5ee112d41b5af9f29957
https://github.com/scummvm/scummvm/commit/d8c8b78afa49fcae610d5ee112d41b5af9f29957
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-01-27T19:03:04+01:00
Commit Message:
DIRECTOR: Register and use additional fonts
Changed paths:
engines/director/frame.cpp
engines/director/score.cpp
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index 68c7cdd..94bb462 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -868,7 +868,7 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo
if (_vm->_currentScore->_fontMap.contains(textCast->fontId)) {
// 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]);
+ //textCast->fontId = _vm->_wm->_fontMan->getFontIdByName(_vm->_currentScore->_fontMap[textCast->fontId]);
}
Graphics::MacFont macFont = Graphics::MacFont(textCast->fontId, textCast->fontSize, textCast->textSlant);
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 778f715..a757fdd 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -914,6 +914,8 @@ void Score::loadFontMap(Common::SeekableSubReadStreamEndian &stream) {
}
_fontMap[id] = font;
+ _vm->_wm->_fontMan->registerFontMapping(id, font);
+
debug(3, "Fontmap. ID %d Font %s", id, font.c_str());
currentRawPosition = stream.pos();
stream.seek(positionInfo);
More information about the Scummvm-git-logs
mailing list