aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--graphics/consolefont.cpp4
-rw-r--r--graphics/font.h12
-rw-r--r--graphics/fontman.cpp35
-rw-r--r--graphics/newfont.cpp4
-rw-r--r--graphics/newfont_big.cpp5
5 files changed, 60 insertions, 0 deletions
diff --git a/graphics/consolefont.cpp b/graphics/consolefont.cpp
index c9184e4b2e..8572ad9868 100644
--- a/graphics/consolefont.cpp
+++ b/graphics/consolefont.cpp
@@ -4777,6 +4777,10 @@ static const FontDesc desc = {
sizeof(_font_bits)/sizeof(bitmap_t)
};
+#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG))
extern const NewFont g_consolefont(desc);
+#else
+DEFINE_FONT(g_consolefont)
+#endif
} // End of namespace Graphics
diff --git a/graphics/font.h b/graphics/font.h
index c67ad1990c..54e1bcc8e0 100644
--- a/graphics/font.h
+++ b/graphics/font.h
@@ -116,6 +116,18 @@ public:
virtual void drawChar(Surface *dst, byte chr, int x, int y, uint32 color) const;
};
+#if (defined(PALMOS_ARM) || defined(PALMOS_DEBUG))
+# define DEFINE_FONT(n) \
+ const NewFont *n; \
+ void create_##n() { \
+ n = new NewFont(desc); \
+ }
+
+# define INIT_FONT(n) \
+ extern void create_##n(); \
+ create_##n();
+#endif
+
} // End of namespace Graphics
#endif
diff --git a/graphics/fontman.cpp b/graphics/fontman.cpp
index e0ca9e5997..11c7dd1879 100644
--- a/graphics/fontman.cpp
+++ b/graphics/fontman.cpp
@@ -25,20 +25,44 @@ DECLARE_SINGLETON(Graphics::FontManager);
namespace Graphics {
+#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG))
const ScummFont g_scummfont;
extern const NewFont g_sysfont;
extern const NewFont g_sysfont_big;
extern const NewFont g_consolefont;
+FontManager::FontManager() {
+}
+
+#else
+const ScummFont *g_scummfont;
+extern const NewFont *g_sysfont;
+extern const NewFont *g_sysfont_big;
+extern const NewFont *g_consolefont;
+
+static bool g_initialized = false;
+void initfonts() {
+ if (!g_initialized) {
+ // FIXME : this need to be freed
+ g_initialized = true;
+ g_scummfont = new ScummFont;
+ INIT_FONT(g_sysfont)
+ INIT_FONT(g_sysfont_big)
+ INIT_FONT(g_consolefont)
+ }
+}
FontManager::FontManager() {
+ initfonts();
}
+#endif
//const Font *FontManager::getFontByName(const Common::String &name) const {
//}
const Font *FontManager::getFontByUsage(FontUsage usage) const {
switch (usage) {
+#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG))
case kOSDFont:
return &g_scummfont;
case kConsoleFont:
@@ -47,7 +71,18 @@ const Font *FontManager::getFontByUsage(FontUsage usage) const {
return &g_sysfont;
case kBigGUIFont:
return &g_sysfont_big;
+#else
+ case kOSDFont:
+ return g_scummfont;
+ case kConsoleFont:
+ return g_consolefont;
+ case kGUIFont:
+ return g_sysfont;
+ case kBigGUIFont:
+ return g_sysfont_big;
+#endif
}
+
return 0;
}
diff --git a/graphics/newfont.cpp b/graphics/newfont.cpp
index 52605e2053..7febc2634b 100644
--- a/graphics/newfont.cpp
+++ b/graphics/newfont.cpp
@@ -2533,6 +2533,10 @@ static const FontDesc desc = {
sizeof(_font_bits)/sizeof(bitmap_t)
};
+#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG))
extern const NewFont g_sysfont(desc);
+#else
+DEFINE_FONT(g_sysfont);
+#endif
} // End of namespace Graphics
diff --git a/graphics/newfont_big.cpp b/graphics/newfont_big.cpp
index 03ee1d91b1..c0ab341d3a 100644
--- a/graphics/newfont_big.cpp
+++ b/graphics/newfont_big.cpp
@@ -6987,6 +6987,11 @@ static const FontDesc desc = {
sizeof(_font_bits)/sizeof(bitmap_t)
};
+#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG))
extern const NewFont g_sysfont_big(desc);
+#else
+DEFINE_FONT(g_sysfont_big)
+#endif
+
} // End of namespace Graphics