1 /***********************************************************
2 * Artsoft Retro-Game Library                               *
3 *----------------------------------------------------------*
4 * (c) 1994-2006 Artsoft Entertainment                      *
5 *               Holger Schemel                             *
6 *               Detmolder Strasse 189                      *
7 *               33604 Bielefeld                            *
8 *               Germany                                    *
9 *               e-mail: info@artsoft.org                   *
10 *----------------------------------------------------------*
11 * text.h                                                   *
12 ***********************************************************/
13 
14 #ifndef TEXT_H
15 #define TEXT_H
16 
17 #include "system.h"
18 
19 
20 /* default fonts */
21 #define FONT_INITIAL_1		0
22 #define FONT_INITIAL_2		1
23 #define FONT_INITIAL_3		2
24 #define FONT_INITIAL_4		3
25 
26 /* font colors */
27 #define FC_RED			FONT_INITIAL_1
28 #define FC_BLUE			FONT_INITIAL_2
29 #define FC_GREEN		FONT_INITIAL_3
30 #define FC_YELLOW		FONT_INITIAL_4
31 
32 /* text output definitions */
33 #define MAX_OUTPUT_LINESIZE	1024
34 
35 /* special character mapping for default fonts */
36 #define FONT_ASCII_CURSOR	((char)160)
37 #define FONT_ASCII_BUTTON	((char)128)
38 #define FONT_ASCII_UP		((char)129)
39 #define FONT_ASCII_DOWN		((char)130)
40 #define FONT_ASCII_LEFT		((char)'<')
41 #define FONT_ASCII_RIGHT	((char)'>')
42 
43 #define MAP_FONT_ASCII(c)	((c) >= 'a' && (c) <= 'z' ? 'A' + (c) - 'a' : \
44 				 (c) == '�'		  ? 96  :	      \
45 				 (c) == '�' || (c) == '�' ? 97  :	      \
46 				 (c) == '�' || (c) == '�' ? 98  :	      \
47 				 (c) == '�' || (c) == '�' ? 99  :	      \
48 				 (c) == '�'		  ? 100 :	      \
49 				 (c) == '�'		  ? 101 :	      \
50 				 (c) == FONT_ASCII_CURSOR ? 102 :	      \
51 				 (c) == FONT_ASCII_BUTTON ? 109 :	      \
52 				 (c) == FONT_ASCII_UP	  ? 110 :	      \
53 				 (c) == FONT_ASCII_DOWN	  ? 111 :	      \
54 				 (c))
55 
56 /* 64 regular ordered ASCII characters, 6 special characters, 1 cursor char. */
57 #define MIN_NUM_CHARS_PER_FONT			64
58 #define DEFAULT_NUM_CHARS_PER_FONT		(MIN_NUM_CHARS_PER_FONT + 6 +1)
59 #define DEFAULT_NUM_CHARS_PER_LINE		16
60 
61 
62 /* font structure definitions */
63 
64 void InitFontInfo(struct FontBitmapInfo *, int,
65 		  int (*function1)(int), int (*function2)(char *));
66 void FreeFontInfo(struct FontBitmapInfo *);
67 
68 struct FontBitmapInfo *getFontBitmapInfo(int);
69 
70 int getFontWidth(int);
71 int getFontHeight(int);
72 int getTextWidth(char *, int);
73 
74 void getFontCharSource(int, char, Bitmap **, int *, int *);
75 
76 int maxWordLengthInString(char *);
77 
78 void DrawInitText(char *, int, int);
79 void DrawInitTextIfNeeded(char *, int, int);
80 void DrawInitTextExt(char *, int, int, boolean);
81 void DrawTextF(int, int, int, char *, ...);
82 void DrawTextFCentered(int, int, char *, ...);
83 void DrawTextS(int, int, int, char *);
84 void DrawTextSCentered(int, int, char *);
85 void DrawTextCentered(int, int, char *);
86 void DrawTextSAligned(int, int, char *, int, int);
87 void DrawTextAligned(int, int, char *, int, int);
88 void DrawText(int, int, char *, int);
89 void DrawTextExt(DrawBuffer *, int, int, char *, int, int);
90 
91 char *GetTextBufferFromFile(char *, int);
92 int DrawTextBuffer(int, int, char *, int, int, int, int, int, int,
93 		   boolean, boolean, boolean);
94 int DrawTextFile(int, int, char *, int, int, int, int, int, int,
95 		 boolean, boolean, boolean);
96 
97 #endif	/* TEXT_H */
98