diff options
author | Dmitry Iskrich | 2016-07-01 18:14:09 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | 56d51f9c1d3cd2003d06d59aa88ef63973ada4f9 (patch) | |
tree | ed55e8b0c52173a8248f8fbb4170157bff02dff2 /engines/director/score.cpp | |
parent | 8a7411fb9751cbfe1c7b3e0c7ee6ccf57a4efdc1 (diff) | |
download | scummvm-rg350-56d51f9c1d3cd2003d06d59aa88ef63973ada4f9.tar.gz scummvm-rg350-56d51f9c1d3cd2003d06d59aa88ef63973ada4f9.tar.bz2 scummvm-rg350-56d51f9c1d3cd2003d06d59aa88ef63973ada4f9.zip |
DIRECTOR: Loading Classic Mac fonts
Diffstat (limited to 'engines/director/score.cpp')
-rw-r--r-- | engines/director/score.cpp | 46 |
1 files changed, 46 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(); |