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 GROOVIE_FONT_H
23 #define GROOVIE_FONT_H
24 
25 #include "common/stream.h"
26 #include "graphics/font.h"
27 
28 namespace Groovie {
29 
30 class T7GFont : public Graphics::Font {
31 public:
32  T7GFont();
33  ~T7GFont() override;
34 
35  bool load(Common::SeekableReadStream &stream);
36 
37  int getFontHeight() const override { return _maxHeight; }
38  int getMaxCharWidth() const override { return _maxWidth; }
39  int getCharWidth(uint32 chr) const override { return getGlyph(chr)->width; }
40  void drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const override;
41 
42 private:
43  int _maxHeight, _maxWidth;
44 
45  struct Glyph {
46  Glyph() : pixels(0), width(0), height(0), julia(0) {}
47  ~Glyph() { delete[] pixels; }
48 
49  byte width;
50  byte height;
51  byte julia;
52  byte *pixels;
53  };
54 
55  byte _mapChar2Glyph[128];
56  Glyph *_glyphs;
57  const Glyph *getGlyph(uint32 chr) const;
58 };
59 
60 } // End of Groovie namespace
61 
62 #endif // GROOVIE_FONT_H
int getCharWidth(uint32 chr) const override
Definition: font.h:39
Definition: font.h:83
Definition: surface.h:67
int getMaxCharWidth() const override
Definition: font.h:38
Definition: stream.h:745
int getFontHeight() const override
Definition: font.h:37
void drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const override
Definition: font.h:30
Definition: cursor.h:32