diff options
author | Miroslav Remák | 2018-07-23 19:49:08 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2018-08-25 23:12:01 +0200 |
commit | 298bfc3d109110b8f4332083b4f9aca850f43eea (patch) | |
tree | 4f2ef34309fe9e5575103a43f77919ab1c8a700e /engines/mutationofjb/font.h | |
parent | cd15dd82a252c3bca1f96a96c4d2c5a2bf4387d9 (diff) | |
download | scummvm-rg350-298bfc3d109110b8f4332083b4f9aca850f43eea.tar.gz scummvm-rg350-298bfc3d109110b8f4332083b4f9aca850f43eea.tar.bz2 scummvm-rg350-298bfc3d109110b8f4332083b4f9aca850f43eea.zip |
MUTATIONOFJB: Subclass Graphics::Font to reuse existing code.
Diffstat (limited to 'engines/mutationofjb/font.h')
-rw-r--r-- | engines/mutationofjb/font.h | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/engines/mutationofjb/font.h b/engines/mutationofjb/font.h index a27303eb0d..51825dbe13 100644 --- a/engines/mutationofjb/font.h +++ b/engines/mutationofjb/font.h @@ -25,7 +25,9 @@ #include "common/scummsys.h" #include "common/hashmap.h" +#include "graphics/font.h" #include "graphics/managed_surface.h" +#include "graphics/surface.h" namespace Common { class String; @@ -33,24 +35,26 @@ class String; namespace MutationOfJB { -class Font { +class Font : public Graphics::Font { + friend class FontBlitOperation; public: - Font(const Common::String &fileName, int horizSpacing, int vertSpacing); - virtual ~Font() {} - int getLineHeight() const; - int16 getWidth(const Common::String &text) const; - void drawString(const Common::String &str, uint8 baseColor, int16 x, int16 y, Graphics::ManagedSurface &surf) const; - void wordWrap(const Common::String &str, int16 maxLineWidth, Common::Array<Common::String> &lines) const; + Font(const Common::String &fileName, int horizSpacing, int lineHeight); + + virtual int getFontHeight() const override; + virtual int getMaxCharWidth() const override; + virtual int getCharWidth(uint32 chr) const override; + virtual int getKerningOffset(uint32 left, uint32 right) const override; + virtual void drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const override; protected: virtual uint8 transformColor(uint8 baseColor, uint8 glyphColor) const; private: - void drawGlyph(uint8 glyph, uint8 baseColor, int16 &x, int16 &y, Graphics::ManagedSurface &surf) const; bool load(const Common::String &fileName); int _horizSpacing; int _lineHeight; + int _maxCharWidth; typedef Common::HashMap<uint8, Graphics::ManagedSurface> GlyphMap; GlyphMap _glyphs; }; |