ScummVM API documentation
font.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef ACCESS_FONT_H
23 #define ACCESS_FONT_H
24 
25 #include "common/scummsys.h"
26 #include "common/array.h"
27 #include "common/rect.h"
28 #include "access/asurface.h"
29 #include "access/data.h"
30 
31 namespace Access {
32 
33 struct FontVal {
34 public:
35  int _lo, _hi;
36 
37  FontVal() { _lo = _hi = 0; }
38 };
39 
40 class Font {
41 protected:
42  byte _firstCharIndex;
43  int _bitWidth;
44  int _height;
46 protected:
50  Font(byte firstCharIndex);
51 public:
52  static byte _fontColors[4];
53 public:
57  virtual ~Font();
58 
62  int charWidth(char c);
63 
67  int stringWidth(const Common::String &msg);
68 
77  bool getLine(Common::String &s, int maxWidth, Common::String &line, int &width);
78 
82  void drawString(BaseSurface *s, const Common::String &msg, const Common::Point &pt);
83 
87  int drawChar(BaseSurface *s, char c, Common::Point &pt);
88 
89 };
90 
91 class AmazonFont : public Font {
92 private:
96  void load(const int *fontIndex, const byte *fontData);
97 public:
101  AmazonFont(const int *fontIndex, const byte *fontData) : Font(32) {
102  load(fontIndex, fontData);
103  }
104 
105 };
106 
107 class MartianFont : public Font {
108 private:
112  void load(Common::SeekableReadStream &s);
113 public:
117  MartianFont(int height, Common::SeekableReadStream &s);
118 };
119 
120 
121 class FontManager {
122 public:
123  FontVal _charSet;
124  FontVal _charFor;
125  int _printMaxX;
126  Font *_font1;
127  Font *_font2;
128 public:
132  FontManager();
133 
137  void load(Font *font1, Font *font2);
138 };
139 
140 } // End of namespace Access
141 
142 #endif /* ACCESS_FONT_H */
Definition: font.h:107
Definition: str.h:59
Definition: font.h:91
Definition: stream.h:745
Definition: asurface.h:42
Definition: font.h:121
Definition: rect.h:45
AmazonFont(const int *fontIndex, const byte *fontData)
Definition: font.h:101
Definition: font.h:40
Definition: access.h:62
Definition: font.h:33