1 
2 /**
3  *
4  * @file font.h
5  *
6  * Part of the OpenJazz project
7  *
8  * @par History:
9  * - 23rd August 2005: Created OpenJazz.h
10  * - 3rd February 2009: Created font.h from parts of OpenJazz.h
11  *
12  * @par Licence:
13  * Copyright (c) 2005-2010 Alister Thomson
14  *
15  * OpenJazz is distributed under the terms of
16  * the GNU General Public License, version 2.0
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21  *
22  */
23 
24 
25 #ifndef _FONT_H
26 #define _FONT_H
27 
28 
29 #include "OpenJazz.h"
30 
31 #include <SDL.h>
32 
33 
34 // Classes
35 
36 class File;
37 
38 /// Font
39 class Font {
40 
41 	private:
42 		SDL_Surface   *characters[128]; ///< Symbol images
43 		int            nCharacters; ///< Number of symbols
44 		unsigned char  lineHeight; ///< Vertical spacing of displayed characters
45 		char           map[128]; ///< Maps ASCII values to symbol indices
46 
47 	public:
48 		Font                     (const char *fileName);
49 		Font                     (unsigned char *pixels, bool big);
50 		Font                     (bool bonus);
51 		~Font                    ();
52 
53 		int  showString          (const char *s, int x, int y);
54 		int  showSceneString     (const unsigned char *s, int x, int y);
55 		void showNumber          (int n, int x, int y);
56 		void mapPalette          (int start, int length, int newStart, int newLength);
57 		void restorePalette      ();
58 		int  getHeight           ();
59 		int  getStringWidth      (const char *string);
60 		int  getSceneStringWidth (const unsigned char *string);
61 
62 };
63 
64 
65 // Variables
66 
67 EXTERN Font *font2;          /** Taken from .0FN file name */
68 EXTERN Font *fontbig;        /** Taken from .0FN file name */
69 EXTERN Font *fontiny;        /** Taken from .0FN file name */
70 EXTERN Font *fontmn1;        /** Taken from .0FN file name */
71 EXTERN Font *fontmn2;        /** Taken from .0FN file name */
72 EXTERN Font *panelBigFont;   /** Found in PANEL.000 */
73 EXTERN Font *panelSmallFont; /** Found in PANEL.000 */
74 
75 #endif
76 
77