From cb960ad976bf523704beb71641bc242501a67a53 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 26 Jul 2009 14:17:40 +0000 Subject: Change the way the font data for SJIS fonts is load. svn-id: r42815 --- graphics/sjis.cpp | 15 ++++++++++++--- graphics/sjis.h | 14 +++++++++++--- 2 files changed, 23 insertions(+), 6 deletions(-) (limited to 'graphics') diff --git a/graphics/sjis.cpp b/graphics/sjis.cpp index 0fad3fff94..a00fdc83cb 100644 --- a/graphics/sjis.cpp +++ b/graphics/sjis.cpp @@ -101,10 +101,19 @@ void FontSJIS16x16::drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1 } } -bool FontTowns::loadFromStream(Common::ReadStream &stream) { +// FM-TOWNS ROM font + +bool FontTowns::loadData() { + Common::SeekableReadStream *data = SearchMan.createReadStreamForMember("FMT_FNT.ROM"); + if (!data) + return false; + for (uint i = 0; i < (kFontRomSize / 2); ++i) - _fontData[i] = stream.readUint16BE(); - return !stream.err(); + _fontData[i] = data->readUint16BE(); + + bool retValue = !data->err(); + delete data; + return retValue; } const uint16 *FontTowns::getCharData(uint16 ch) const { diff --git a/graphics/sjis.h b/graphics/sjis.h index 661a8834b0..141a1ed13a 100644 --- a/graphics/sjis.h +++ b/graphics/sjis.h @@ -49,6 +49,11 @@ class FontSJIS { public: virtual ~FontSJIS() {} + /** + * Load the font data. + */ + virtual bool loadData() = 0; + /** * Enable outline drawing. * @@ -87,6 +92,9 @@ public: virtual void drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1, uint32 c2) const = 0; }; +/** + * A base class to render 16x16 monochrome SJIS fonts. + */ class FontSJIS16x16 : public FontSJIS { public: FontSJIS16x16() : _outlineEnabled(false) {} @@ -119,9 +127,9 @@ protected: class FontTowns : public FontSJIS16x16 { public: /** - * Loads the ROM data from the given read stream. + * Loads the ROM data from "FMT_FNT.ROM". */ - bool loadFromStream(Common::ReadStream &stream); + bool loadData(); private: enum { @@ -142,7 +150,7 @@ public: ~FontSjisSVM() { delete[] _fontData; } /** - * Load the ROM data from "SJIS.FNT". + * Load the font data from "SJIS.FNT". */ bool loadData(); -- cgit v1.2.3