aboutsummaryrefslogtreecommitdiff
path: root/graphics/macgui
diff options
context:
space:
mode:
authorEugene Sandulenko2017-01-17 20:28:12 +0100
committerEugene Sandulenko2017-01-17 20:30:32 +0100
commit4ede54e6b0f76201937fc90387f3579fbb546719 (patch)
treee5ba68dfcfac176541a6eba7e81155bdc2ec32a3 /graphics/macgui
parent1fea15ac7bb4533bc2e6a90b5a9661ce56430bb0 (diff)
downloadscummvm-rg350-4ede54e6b0f76201937fc90387f3579fbb546719.tar.gz
scummvm-rg350-4ede54e6b0f76201937fc90387f3579fbb546719.tar.bz2
scummvm-rg350-4ede54e6b0f76201937fc90387f3579fbb546719.zip
GRAPHICS: Rename MacFont to MacFONTFont to avoid clashed
Diffstat (limited to 'graphics/macgui')
-rw-r--r--graphics/macgui/macfontmanager.cpp54
-rw-r--r--graphics/macgui/macfontmanager.h1
2 files changed, 54 insertions, 1 deletions
diff --git a/graphics/macgui/macfontmanager.cpp b/graphics/macgui/macfontmanager.cpp
index c6e8d7e4a7..721f1a703e 100644
--- a/graphics/macgui/macfontmanager.cpp
+++ b/graphics/macgui/macfontmanager.cpp
@@ -22,7 +22,9 @@
#include "common/archive.h"
#include "common/stream.h"
#include "common/unzip.h"
+#include "common/macresman.h"
#include "graphics/fonts/bdf.h"
+#include "graphics/fonts/macfont.h"
#include "graphics/macgui/macfontmanager.h"
@@ -80,7 +82,7 @@ MacFontManager::MacFontManager() {
loadFonts();
}
-void MacFontManager::loadFonts() {
+void MacFontManager::loadFontsBDF() {
Common::Archive *dat;
dat = Common::makeZipArchive("classicmacfonts.dat");
@@ -138,6 +140,56 @@ void MacFontManager::loadFonts() {
delete dat;
}
+void MacFontManager::loadFonts() {
+ Common::Archive *dat;
+
+ dat = Common::makeZipArchive("classicmacfonts.dat");
+
+ if (!dat) {
+ warning("Could not find classicmacfonts.dat. Falling back to built-in fonts");
+ _builtInFonts = true;
+
+ 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());
+
+ Common::MacResManager *fontFile = new Common::MacResManager();
+
+ if (!fontFile->loadFromMacBinary(*stream))
+ error("Could not open %s as a resource fork", (*it)->getName().c_str());
+
+ 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);
+
+ Graphics::MacFontFamily fontFamily;
+ fontFamily.load(*fond);
+
+ Common::Array<Graphics::MacFontFamily::AsscEntry> *assoc = fontFamily.getAssocTable();
+
+ for (uint i = 0; i < assoc->size(); i++) {
+ debug("size: %d style: %d id: %d", (*assoc)[i]._fontSize, (*assoc)[i]._fontSize,
+ (*assoc)[i]._fontID);
+ }
+
+ delete fond;
+ }
+ }
+
+ delete stream;
+ }
+
+ _builtInFonts = false;
+
+ delete dat;
+}
+
const Font *MacFontManager::getFont(MacFont macFont) {
const Font *font = 0;
diff --git a/graphics/macgui/macfontmanager.h b/graphics/macgui/macfontmanager.h
index c098d797ed..117e884d96 100644
--- a/graphics/macgui/macfontmanager.h
+++ b/graphics/macgui/macfontmanager.h
@@ -121,6 +121,7 @@ public:
int getFontIdByName(Common::String name);
private:
+ void loadFontsBDF();
void loadFonts();
void generateFontSubstitute(MacFont &macFont);