diff options
author | Johannes Schickel | 2009-07-26 14:17:54 +0000 |
---|---|---|
committer | Johannes Schickel | 2009-07-26 14:17:54 +0000 |
commit | ebc74a7c9bf9c8066723eb79223970d6238463a8 (patch) | |
tree | dd1a3d56b50269aa735dfda00446f1501f955bcd /graphics | |
parent | cb960ad976bf523704beb71641bc242501a67a53 (diff) | |
download | scummvm-rg350-ebc74a7c9bf9c8066723eb79223970d6238463a8.tar.gz scummvm-rg350-ebc74a7c9bf9c8066723eb79223970d6238463a8.tar.bz2 scummvm-rg350-ebc74a7c9bf9c8066723eb79223970d6238463a8.zip |
Add a factory method, which tries to open different SJIS fonts/ROMs and returns a font for the first present data.
svn-id: r42816
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/sjis.cpp | 18 | ||||
-rw-r--r-- | graphics/sjis.h | 13 |
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; |