aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--graphics/sjis.cpp18
-rw-r--r--graphics/sjis.h13
2 files changed, 31 insertions, 0 deletions
diff --git a/graphics/sjis.cpp b/graphics/sjis.cpp
index a00fdc83cb..d4702fc89e 100644
--- a/graphics/sjis.cpp
+++ b/graphics/sjis.cpp
@@ -31,6 +31,24 @@
namespace Graphics {
+FontSJIS *FontSJIS::createFont() {
+ FontSJIS *ret = 0;
+
+ // First try ScummVM's font.
+ ret = new FontSjisSVM();
+ if (ret && ret->loadData())
+ return ret;
+ delete ret;
+
+ // Next try the FM-Towns font ROM.
+ ret = new FontTowns();
+ if (ret && ret->loadData())
+ return ret;
+ delete ret;
+
+ return 0;
+}
+
template<typename Color>
void FontSJIS16x16::drawCharInternOutline(const uint16 *glyph, uint8 *dst, int pitch, Color c1, Color c2) const {
uint32 outlineGlyph[18];
diff --git a/graphics/sjis.h b/graphics/sjis.h
index 141a1ed13a..60bf7844a3 100644
--- a/graphics/sjis.h
+++ b/graphics/sjis.h
@@ -50,6 +50,19 @@ public:
virtual ~FontSJIS() {}
/**
+ * Creates the first SJIS font, which ROM/font file is present.
+ * It will also call loadData, so the user can just start
+ * using the font.
+ *
+ * It will prefer ScummVM's font.
+ *
+ * TODO: Consider adding some way to overwrite the first checked
+ * font, some games might want to prefer the original ROM over
+ * ScummVM's.
+ */
+ static FontSJIS *createFont();
+
+ /**
* Load the font data.
*/
virtual bool loadData() = 0;