ScummVM API documentation
cryofont.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 CRYOMNI3D_FONTS_CRYOFONT_H
23#define CRYOMNI3D_FONTS_CRYOFONT_H
24
25#include "common/array.h"
26#include "common/hashmap.h"
27#include "common/str.h"
28#include "graphics/font.h"
29
30namespace Common {
31class SeekableReadStream;
32}
33
34namespace CryOmni3D {
35
36class CryoFont : public Graphics::Font {
37public:
38 CryoFont() : _height(0), _maxAdvance(0) { }
39
40 void load(const Common::Path &fontFile);
41
42 virtual int getFontHeight() const { return _height; }
43 virtual int getMaxCharWidth() const { return _maxAdvance; }
44
45 virtual int getCharWidth(uint32 chr) const;
46
47 virtual Common::Rect getBoundingBox(uint32 chr) const;
48
49 virtual void drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const;
50
51private:
52 void loadAll8bitGlyphs(Common::SeekableReadStream &font_fl);
53 uint32 mapGlyph(uint32 chr) const;
54
55 struct Glyph {
56 uint16 h;
57 uint16 w;
58 int16 offX;
59 int16 offY;
60 uint16 advance;
61
62 byte *bitmap;
63
64 Glyph();
65 ~Glyph();
66
67 uint setup(uint16 width, uint16 height);
68 };
69
70 static const uint k8bitCharactersCount = 223;
71
72 uint16 _height;
73 uint16 _maxAdvance;
74 byte _comment[32];
75
76 Glyph _glyphs[k8bitCharactersCount];
77};
78
79} // End of namespace CryOmni3D
80
81#endif
Definition: path.h:52
Definition: stream.h:745
Definition: cryofont.h:36
virtual Common::Rect getBoundingBox(uint32 chr) const
virtual int getCharWidth(uint32 chr) const
virtual int getMaxCharWidth() const
Definition: cryofont.h:43
virtual int getFontHeight() const
Definition: cryofont.h:42
virtual void drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const
Definition: font.h:83
Definition: algorithm.h:29
Definition: cryomni3d.h:62
Definition: rect.h:536
Definition: surface.h:67