From 6fa46810f5df7f3db69c646589edc8703d56a8cd Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 19 Jan 2017 11:11:05 +0100 Subject: GRAPHICS: Encapsulate all MacFONTFont class variables into a single struct --- graphics/fonts/macfont.h | 75 ++++++++++++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 34 deletions(-) (limited to 'graphics/fonts/macfont.h') diff --git a/graphics/fonts/macfont.h b/graphics/fonts/macfont.h index 69164653b4..ba19772cc5 100644 --- a/graphics/fonts/macfont.h +++ b/graphics/fonts/macfont.h @@ -97,24 +97,21 @@ private: Common::Array _ffKernEntries; }; -/** - * Processing of Mac FONT/NFNT rResources - */ -class MacFONTFont : public Font { -public: - MacFONTFont(); - virtual ~MacFONTFont(); - - virtual int getFontHeight() const; - virtual int getMaxCharWidth() const; - virtual int getCharWidth(uint32 chr) const; - virtual void drawChar(Surface *dst, uint32 chr, int x, int y, uint32 color) const; - - bool loadFont(Common::SeekableReadStream &stream, MacFontFamily *family = nullptr, int size = 12, int style = 0); - - virtual int getKerningOffset(uint32 left, uint32 right) const; +struct MacGlyph { + void clear() { + bitmapOffset = 0; + width = 0; + bitmapWidth = 0; + kerningOffset = 0; + } + + uint16 bitmapOffset; + byte width; + uint16 bitmapWidth; + int kerningOffset; +}; -private: +struct MacFONTdata { uint16 _fontType; uint16 _firstChar; uint16 _lastChar; @@ -131,29 +128,39 @@ private: byte *_bitImage; - struct Glyph { - void clear() { - bitmapOffset = 0; - width = 0; - bitmapWidth = 0; - kerningOffset = 0; - } - - uint16 bitmapOffset; - byte width; - uint16 bitmapWidth; - int kerningOffset; - }; - - Common::Array _glyphs; - Glyph _defaultChar; - const Glyph *findGlyph(uint32 c) const; + Common::Array _glyphs; + MacGlyph _defaultChar; MacFontFamily *_family; int _size; int _style; }; +/** + * Processing of Mac FONT/NFNT rResources + */ +class MacFONTFont : public Font { +public: + MacFONTFont(); + virtual ~MacFONTFont(); + + virtual int getFontHeight() const { return _data._fRectHeight; } + virtual int getMaxCharWidth() const { return _data._maxWidth; } + virtual int getCharWidth(uint32 chr) const; + virtual void drawChar(Surface *dst, uint32 chr, int x, int y, uint32 color) const; + + bool loadFont(Common::SeekableReadStream &stream, MacFontFamily *family = nullptr, int size = 12, int style = 0); + + virtual int getKerningOffset(uint32 left, uint32 right) const; + + int getFontSize() const { return _data._size; } + +private: + MacFONTdata _data; + + const MacGlyph *findGlyph(uint32 c) const; +}; + } // End of namespace Graphics #endif -- cgit v1.2.3