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 NUVIE_FONTS_FONT_H
24 #define NUVIE_FONTS_FONT_H
25 
26 namespace Ultima {
27 namespace Nuvie {
28 
29 #define FONT_COLOR_U6_NORMAL    0x48
30 #define FONT_COLOR_U6_HIGHLIGHT 0x0c
31 #define FONT_COLOR_WOU_NORMAL    0
32 #define FONT_COLOR_WOU_CONVERSE_INPUT 1
33 
34 #define FONT_COLOR_WOU_HIGHLIGHT 4
35 
36 #define FONT_UP_ARROW_CHAR   19
37 #define FONT_DOWN_ARROW_CHAR 20
38 
39 class Configuration;
40 class Screen;
41 class U6Shape;
42 
43 class Font {
44 protected:
45 	uint16 num_chars;
46 	uint16 offset;
47 	uint8 default_color, default_highlight_color;
48 
49 private:
50 
51 
52 public:
53 
54 	Font();
55 	virtual ~Font();
getDefaultColor()56 	uint8 getDefaultColor() {
57 		return default_color;
58 	}
setDefaultColor(uint8 color)59 	void setDefaultColor(uint8 color) {
60 		default_color = color;
61 	}
setDefaultHighlightColor(uint8 color)62 	void setDefaultHighlightColor(uint8 color) {
63 		default_highlight_color = color;
64 	}
65 
66 //   bool drawString(Screen *screen, Std::string str, uint16 x, uint16 y);
67 	uint16 drawString(Screen *screen, const char *str, uint16 x, uint16 y);
68 	uint16 drawString(Screen *screen, const char *str, uint16 x, uint16 y, uint8 color, uint8 highlight_color);
69 	uint16 drawString(Screen *screen, const char *str, uint16 string_len, uint16 x, uint16 y, uint8 color, uint8 highlight_color);
70 
71 	uint16 drawChar(Screen *screen, uint8 char_num, uint16 x, uint16 y);
72 	virtual uint16 drawChar(Screen *screen, uint8 char_num, uint16 x, uint16 y,
73 	                        uint8 color) = 0;
74 
75 	uint16 drawStringToShape(U6Shape *shp, const char *str, uint16 x, uint16 y, uint8 color);
76 	uint8 drawCharToShape(U6Shape *shp, uint8 char_num, uint16 x, uint16 y, uint8 color);
77 
78 	virtual uint16 getCharWidth(uint8 c) = 0;
79 	virtual uint16 getCharHeight() = 0;
80 	uint16 getStringWidth(const char *str);
81 	virtual uint16 getStringWidth(const char *str, uint16 string_len);
82 
setOffset(uint16 off)83 	void setOffset(uint16 off) {
84 		offset = off;
85 	}
86 
87 protected:
88 
89 	uint8 get_char_num(uint8 c);
90 
91 };
92 
93 } // End of namespace Nuvie
94 } // End of namespace Ultima
95 
96 #endif
97