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
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef BLADERUNNER_FONT_H
24 #define BLADERUNNER_FONT_H
25 
26 #include "common/array.h"
27 #include "common/str.h"
28 
29 #include "graphics/font.h"
30 
31 namespace Graphics {
32 struct Surface;
33 }
34 
35 namespace BladeRunner {
36 
37 class BladeRunnerEngine;
38 
39 class Font : public Graphics::Font {
40 	struct Character {
41 		int x;
42 		int y;
43 		int width;
44 		int height;
45 		int dataOffset;
46 	};
47 
48 	uint32                   _characterCount;
49 	int                      _maxWidth;
50 	int                      _maxHeight;
51 	Common::Array<Character> _characters;
52 	int                      _dataSize;
53 	uint16                  *_data;
54 	int                      _screenWidth;
55 	int                      _screenHeight;
56 	int                      _spacing;
57 	bool                     _useFontColor;
58 
59 public:
60 	~Font() override;
61 
62 	static Font* load(BladeRunnerEngine *vm, const Common::String &fileName, int spacing, bool useFontColor);
63 
64 	int getFontHeight() const override;
65 	int getMaxCharWidth() const override;
66 	int getCharWidth(uint32 chr) const override;
67 	void drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const override;
68 
69 private:
70 	Font();
71 	void reset();
72 	void close();
73 	// void drawCharacter(const uint8 character, Graphics::Surface &surface, int x, int y) const;
74 };
75 
76 } // End of namespace BladeRunner
77 
78 #endif
79