aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Iskrich2016-07-01 18:14:09 +0300
committerEugene Sandulenko2016-08-03 23:40:36 +0200
commit56d51f9c1d3cd2003d06d59aa88ef63973ada4f9 (patch)
treeed55e8b0c52173a8248f8fbb4170157bff02dff2
parent8a7411fb9751cbfe1c7b3e0c7ee6ccf57a4efdc1 (diff)
downloadscummvm-rg350-56d51f9c1d3cd2003d06d59aa88ef63973ada4f9.tar.gz
scummvm-rg350-56d51f9c1d3cd2003d06d59aa88ef63973ada4f9.tar.bz2
scummvm-rg350-56d51f9c1d3cd2003d06d59aa88ef63973ada4f9.zip
DIRECTOR: Loading Classic Mac fonts
-rw-r--r--engines/director/score.cpp46
-rw-r--r--engines/director/score.h1
2 files changed, 47 insertions, 0 deletions
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index fc24de77c8..25154ccf8a 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -24,7 +24,9 @@
#include "common/stream.h"
#include "common/debug.h"
#include "common/file.h"
+#include "common/archive.h"
#include "common/config-manager.h"
+#include "common/unzip.h"
#include "common/system.h"
#include "director/dib.h"
@@ -38,10 +40,12 @@
#include "graphics/managed_surface.h"
#include "image/bmp.h"
#include "graphics/fontman.h"
+#include "graphics/fonts/bdf.h"
namespace Director {
Score::Score(DirectorEngine *vm) {
+ loadMacFonts();
_vm = vm;
_surface = new Graphics::ManagedSurface;
_trailSurface = new Graphics::ManagedSurface;
@@ -591,11 +595,53 @@ void Score::loadFontMap(Common::SeekableSubReadStreamEndian &stream) {
}
_fontMap[id] = font;
+ debug(3, "ID %d Font %s", id, font.c_str());
currentRawPosition = stream.pos();
stream.seek(positionInfo);
}
}
+void Score::loadMacFonts() {
+ //Copy from Wage
+ Common::Archive *dat;
+
+ dat = Common::makeZipArchive("classicmacfonts.dat");
+
+ if (!dat) {
+ warning("Could not find classicmacfonts.dat. Falling back to built-in fonts");
+ return;
+ }
+
+ Common::ArchiveMemberList list;
+ dat->listMembers(list);
+
+ for (Common::ArchiveMemberList::iterator it = list.begin(); it != list.end(); ++it) {
+ Common::SeekableReadStream *stream = dat->createReadStreamForMember((*it)->getName());
+
+ Graphics::BdfFont *font = Graphics::BdfFont::loadFont(*stream);
+
+ delete stream;
+
+ Common::String fontName = (*it)->getName();
+
+ // Trim the .bdf extension
+ for (int i = fontName.size() - 1; i >= 0; --i) {
+ if (fontName[i] == '.') {
+ while ((uint)i < fontName.size()) {
+ fontName.deleteLastChar();
+ }
+ break;
+ }
+ }
+
+ FontMan.assignFontToName(fontName, font);
+
+ debug(" %s", fontName.c_str());
+ }
+
+ delete dat;
+}
+
BitmapCast::BitmapCast(Common::SeekableSubReadStreamEndian &stream) {
/*byte flags = */ stream.readByte();
uint16 someFlaggyThing = stream.readUint16();
diff --git a/engines/director/score.h b/engines/director/score.h
index 459d2e9462..f3efd56482 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -357,6 +357,7 @@ private:
void update();
void readVersion(uint32 rid);
void loadConfig(Common::SeekableSubReadStreamEndian &stream);
+ void loadMacFonts();
void loadPalette(Common::SeekableSubReadStreamEndian &stream);
void loadFrames(Common::SeekableSubReadStreamEndian &stream);
void loadLabels(Common::SeekableSubReadStreamEndian &stream);