aboutsummaryrefslogtreecommitdiff
path: root/graphics/fonts/macfont.h
diff options
context:
space:
mode:
authorEugene Sandulenko2017-01-19 11:11:05 +0100
committerEugene Sandulenko2017-01-19 11:11:05 +0100
commit6fa46810f5df7f3db69c646589edc8703d56a8cd (patch)
tree011fb574cf4b417d25b58a1fa23b8e0befae1504 /graphics/fonts/macfont.h
parenta95b8f95dd1bcf8cc72e2a9ed3eac9e98e1430aa (diff)
downloadscummvm-rg350-6fa46810f5df7f3db69c646589edc8703d56a8cd.tar.gz
scummvm-rg350-6fa46810f5df7f3db69c646589edc8703d56a8cd.tar.bz2
scummvm-rg350-6fa46810f5df7f3db69c646589edc8703d56a8cd.zip
GRAPHICS: Encapsulate all MacFONTFont class variables into a single struct
Diffstat (limited to 'graphics/fonts/macfont.h')
-rw-r--r--graphics/fonts/macfont.h75
1 files changed, 41 insertions, 34 deletions
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<KernEntry> _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<Glyph> _glyphs;
- Glyph _defaultChar;
- const Glyph *findGlyph(uint32 c) const;
+ Common::Array<MacGlyph> _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