[Scummvm-git-logs] scummvm master -> 399f5b9be55f61d8b7650d77af8db9fbf43bde73
sev-
sev at scummvm.org
Thu Jan 26 19:13:08 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:
d99036a480 GRAPHICS: More fixes to MacFont scaling. Now it does work
2991871d03 GRAPHICS: Refactor Mac font loading into per file method
399f5b9be5 DIRECTOR: Plug in MacFont loading from Shared Casts
Commit: d99036a480eda3a0449215f7b240e0ee12aadaa1
https://github.com/scummvm/scummvm/commit/d99036a480eda3a0449215f7b240e0ee12aadaa1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-01-26T18:45:24+01:00
Commit Message:
GRAPHICS: More fixes to MacFont scaling. Now it does work
Changed paths:
graphics/fonts/macfont.cpp
diff --git a/graphics/fonts/macfont.cpp b/graphics/fonts/macfont.cpp
index 820936c..601962f 100644
--- a/graphics/fonts/macfont.cpp
+++ b/graphics/fonts/macfont.cpp
@@ -412,7 +412,7 @@ MacFONTFont *MacFONTFont::scaleFont(const MacFONTFont *src, int newSize) {
data._fontType = src->_data._fontType;
data._firstChar = src->_data._firstChar;
- data._lastChar = src->_data._firstChar;
+ data._lastChar = src->_data._lastChar;
data._maxWidth = (int)((float)src->_data._maxWidth * scale);
data._kernMax = (int)((float)src->_data._kernMax * scale);
data._nDescent = (int)((float)src->_data._nDescent * scale);
@@ -445,7 +445,7 @@ MacFONTFont *MacFONTFont::scaleFont(const MacFONTFont *src, int newSize) {
data._rowWords = newBitmapWidth;
- uint16 bitImageSize = data._rowWords * data._fRectHeight;
+ uint bitImageSize = data._rowWords * data._fRectHeight;
data._bitImage = new byte[bitImageSize];
int srcPitch = src->_data._rowWords;
Commit: 2991871d03a93e3ea543f23d10586d428ffbccc7
https://github.com/scummvm/scummvm/commit/2991871d03a93e3ea543f23d10586d428ffbccc7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-01-26T18:50:33+01:00
Commit Message:
GRAPHICS: Refactor Mac font loading into per file method
Changed paths:
graphics/macgui/macfontmanager.cpp
graphics/macgui/macfontmanager.h
diff --git a/graphics/macgui/macfontmanager.cpp b/graphics/macgui/macfontmanager.cpp
index 4c8b9eb..9d66e49 100644
--- a/graphics/macgui/macfontmanager.cpp
+++ b/graphics/macgui/macfontmanager.cpp
@@ -158,68 +158,72 @@ void MacFontManager::loadFonts() {
for (Common::ArchiveMemberList::iterator it = list.begin(); it != list.end(); ++it) {
Common::SeekableReadStream *stream = dat->createReadStreamForMember((*it)->getName());
- Common::MacResManager *fontFile = new Common::MacResManager();
+ loadFontsFromStream(stream);
+ }
- if (!fontFile->loadFromMacBinary(*stream))
- continue;
+ _builtInFonts = false;
- Common::MacResIDArray fonds = fontFile->getResIDArray(MKTAG('F','O','N','D'));
- if (fonds.size() > 0) {
- for (Common::Array<uint16>::iterator iterator = fonds.begin(); iterator != fonds.end(); ++iterator) {
- Common::SeekableReadStream *fond = fontFile->getResource(MKTAG('F', 'O', 'N', 'D'), *iterator);
+ delete dat;
+}
- Common::String familyName = fontFile->getResName(MKTAG('F', 'O', 'N', 'D'), *iterator);
+void MacFontManager::loadFontsFromStream(Common::SeekableReadStream *stream) {
+ Common::MacResManager *fontFile = new Common::MacResManager();
- Graphics::MacFontFamily *fontFamily = new MacFontFamily();
- fontFamily->load(*fond);
+ if (!fontFile->loadFromMacBinary(*stream))
+ return;
- Common::Array<Graphics::MacFontFamily::AsscEntry> *assoc = fontFamily->getAssocTable();
+ Common::MacResIDArray fonds = fontFile->getResIDArray(MKTAG('F','O','N','D'));
+ if (fonds.size() > 0) {
+ for (Common::Array<uint16>::iterator iterator = fonds.begin(); iterator != fonds.end(); ++iterator) {
+ Common::SeekableReadStream *fond = fontFile->getResource(MKTAG('F', 'O', 'N', 'D'), *iterator);
- for (uint i = 0; i < assoc->size(); i++) {
- debug("size: %d style: %d id: %d", (*assoc)[i]._fontSize, (*assoc)[i]._fontStyle,
- (*assoc)[i]._fontID);
+ Common::String familyName = fontFile->getResName(MKTAG('F', 'O', 'N', 'D'), *iterator);
- Common::SeekableReadStream *fontstream;
- MacFont *macfont;
- Graphics::MacFONTFont *font;
+ Graphics::MacFontFamily *fontFamily = new MacFontFamily();
+ fontFamily->load(*fond);
- fontstream = fontFile->getResource(MKTAG('N', 'F', 'N', 'T'), (*assoc)[i]._fontID);
+ Common::Array<Graphics::MacFontFamily::AsscEntry> *assoc = fontFamily->getAssocTable();
- if (!fontstream)
- fontstream = fontFile->getResource(MKTAG('F', 'O', 'N', 'T'), (*assoc)[i]._fontID);
+ for (uint i = 0; i < assoc->size(); i++) {
+ debug("size: %d style: %d id: %d", (*assoc)[i]._fontSize, (*assoc)[i]._fontStyle,
+ (*assoc)[i]._fontID);
- if (!fontstream) {
- warning("Unknown FontId: %d", (*assoc)[i]._fontID);
+ Common::SeekableReadStream *fontstream;
+ MacFont *macfont;
+ Graphics::MacFONTFont *font;
- continue;
- }
+ fontstream = fontFile->getResource(MKTAG('N', 'F', 'N', 'T'), (*assoc)[i]._fontID);
- font = new Graphics::MacFONTFont;
- font->loadFont(*fontstream, fontFamily, (*assoc)[i]._fontSize, (*assoc)[i]._fontStyle);
+ if (!fontstream)
+ fontstream = fontFile->getResource(MKTAG('F', 'O', 'N', 'T'), (*assoc)[i]._fontID);
- delete fontstream;
+ if (!fontstream) {
+ warning("Unknown FontId: %d", (*assoc)[i]._fontID);
- Common::String fontName = Common::String::format("%s-%d-%d", familyName.c_str(), (*assoc)[i]._fontStyle, (*assoc)[i]._fontSize);
+ continue;
+ }
- macfont = new MacFont(_fontNames.getVal(familyName, kMacFontNonStandard), (*assoc)[i]._fontSize, (*assoc)[i]._fontStyle);
+ font = new Graphics::MacFONTFont;
+ font->loadFont(*fontstream, fontFamily, (*assoc)[i]._fontSize, (*assoc)[i]._fontStyle);
- FontMan.assignFontToName(fontName, font);
- macfont->setFont(font);
- _fontRegistry.setVal(fontName, macfont);
+ delete fontstream;
- debug(2, " %s", fontName.c_str());
- }
+ Common::String fontName = Common::String::format("%s-%d-%d", familyName.c_str(), (*assoc)[i]._fontStyle, (*assoc)[i]._fontSize);
- delete fond;
+ macfont = new MacFont(_fontNames.getVal(familyName, kMacFontNonStandard), (*assoc)[i]._fontSize, (*assoc)[i]._fontStyle);
+
+ FontMan.assignFontToName(fontName, font);
+ macfont->setFont(font);
+ _fontRegistry.setVal(fontName, macfont);
+
+ debug(2, " %s", fontName.c_str());
}
- }
- delete fontFile;
+ delete fond;
+ }
}
- _builtInFonts = false;
-
- delete dat;
+ delete fontFile;
}
const Font *MacFontManager::getFont(MacFont macFont) {
diff --git a/graphics/macgui/macfontmanager.h b/graphics/macgui/macfontmanager.h
index 8c1ed50..6d6122e 100644
--- a/graphics/macgui/macfontmanager.h
+++ b/graphics/macgui/macfontmanager.h
@@ -25,6 +25,10 @@
#include "graphics/fontman.h"
+namespace Common {
+ class SeekableReadStream;
+}
+
namespace Graphics {
class MacFONTFont;
@@ -122,6 +126,8 @@ public:
const char *getFontName(MacFont &font);
int getFontIdByName(Common::String name);
+ void loadFontsFromStream(Common::SeekableReadStream *stream);
+
private:
void loadFontsBDF();
void loadFonts();
Commit: 399f5b9be55f61d8b7650d77af8db9fbf43bde73
https://github.com/scummvm/scummvm/commit/399f5b9be55f61d8b7650d77af8db9fbf43bde73
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-01-26T19:08:11+01:00
Commit Message:
DIRECTOR: Plug in MacFont loading from Shared Casts
Changed paths:
engines/director/archive.cpp
engines/director/archive.h
engines/director/resource.cpp
engines/director/score.cpp
diff --git a/engines/director/archive.cpp b/engines/director/archive.cpp
index 593fb63..496f47c 100644
--- a/engines/director/archive.cpp
+++ b/engines/director/archive.cpp
@@ -66,10 +66,13 @@ void Archive::close() {
_stream = 0;
}
-bool Archive::hasResource(uint32 tag, uint16 id) const {
+bool Archive::hasResource(uint32 tag, int id) const {
if (!_types.contains(tag))
return false;
+ if (id == -1)
+ return true;
+
return _types[tag].contains(id);
}
@@ -408,7 +411,7 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
keyRes = &resources[resources.size() - 1];
else if (tag == MKTAG('C', 'A', 'S', '*'))
casRes = &resources[resources.size() - 1];
- //or the children of
+ //or the children of
else if (tag == MKTAG('S', 'T', 'X', 'T') ||
tag == MKTAG('B', 'I', 'T', 'D') ||
tag == MKTAG('D', 'I', 'B', ' '))
diff --git a/engines/director/archive.h b/engines/director/archive.h
index b77bace..40b15d5 100644
--- a/engines/director/archive.h
+++ b/engines/director/archive.h
@@ -33,7 +33,7 @@ class MacResManager;
namespace Director {
// Completely ripped off of Mohawk's Archive code
-
+
struct Resource {
uint32 index;
uint32 offset;
@@ -56,7 +56,7 @@ public:
bool isOpen() const { return _stream != 0; }
- bool hasResource(uint32 tag, uint16 id) const;
+ bool hasResource(uint32 tag, int id) const;
bool hasResource(uint32 tag, const Common::String &resName) const;
virtual Common::SeekableSubReadStreamEndian *getResource(uint32 tag, uint16 id);
virtual Resource getResourceDetail(uint32 tag, uint16 id);
diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp
index 8bb4e82..f2a44d5 100644
--- a/engines/director/resource.cpp
+++ b/engines/director/resource.cpp
@@ -21,6 +21,8 @@
*/
#include "common/macresman.h"
+#include "graphics/macgui/macwindowmanager.h"
+#include "graphics/macgui/macfontmanager.h"
#include "director/director.h"
#include "director/archive.h"
@@ -214,6 +216,18 @@ void DirectorEngine::loadSharedCastsFrom(Common::String filename) {
Score *castScore = new Score(this, shardcst);
+ if (shardcst->hasResource(MKTAG('F', 'O', 'N', 'D'), -1)) {
+ debug("Shared cast has fonts. Loading....");
+
+ Common::File file;
+
+ if (!file.open(filename)) {
+ warning("Oops, cannot open file");
+ } else {
+ _wm->_fontMan->loadFontsFromStream(&file);
+ }
+ }
+
castScore->loadConfig(*shardcst->getResource(MKTAG('V','W','C','F'), 1024));
if (getVersion() < 4)
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 18ab4c9..778f715 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -198,6 +198,10 @@ void Score::loadArchive() {
g_system->getPaletteManager()->setPalette(_vm->getPalette(), 0, _vm->getPaletteColorCount());
}
+ if (_movieArchive->hasResource(MKTAG('F', 'O', 'N', 'D'), -1)) {
+ debug("Movie has fonts. Loading....");
+ }
+
assert(_movieArchive->hasResource(MKTAG('V', 'W', 'S', 'C'), 1024));
assert(_movieArchive->hasResource(MKTAG('V', 'W', 'C', 'F'), 1024));
More information about the Scummvm-git-logs
mailing list