1 // ============================================================================
2 // Artsoft Retro-Game Library
3 // ----------------------------------------------------------------------------
4 // (c) 1995-2014 by Artsoft Entertainment
7 // https://www.artsoft.org/
8 // ----------------------------------------------------------------------------
10 // ============================================================================
19 #define MAIN_FONT_INITIAL_1 0
20 #define MAIN_FONT_INITIAL_2 1
21 #define MAIN_FONT_INITIAL_3 2
22 #define MAIN_FONT_INITIAL_4 3
25 #define FC_RED MAIN_FONT_INITIAL_1
26 #define FC_BLUE MAIN_FONT_INITIAL_2
27 #define FC_GREEN MAIN_FONT_INITIAL_3
28 #define FC_YELLOW MAIN_FONT_INITIAL_4
30 // text output definitions
31 #define MAX_OUTPUT_LINESIZE 1024
33 // special constants for old ISO-8859-1 character byte values
34 #define CHAR_BYTE_UMLAUT_A ((char)0xc4)
35 #define CHAR_BYTE_UMLAUT_O ((char)0xd6)
36 #define CHAR_BYTE_UMLAUT_U ((char)0xdc)
37 #define CHAR_BYTE_UMLAUT_a ((char)0xe4)
38 #define CHAR_BYTE_UMLAUT_o ((char)0xf6)
39 #define CHAR_BYTE_UMLAUT_u ((char)0xfc)
40 #define CHAR_BYTE_SHARP_S ((char)0xdf)
41 #define CHAR_BYTE_COPYRIGHT ((char)0xa9)
42 #define CHAR_BYTE_REGISTERED ((char)0xae)
43 #define CHAR_BYTE_DEGREE ((char)0xb0)
44 #define CHAR_BYTE_CURSOR ((char)0xa0)
46 // special character mapping for default fonts
47 #define FONT_ASCII_CURSOR ((char)160)
48 #define FONT_ASCII_BUTTON ((char)128)
49 #define FONT_ASCII_UP ((char)129)
50 #define FONT_ASCII_DOWN ((char)130)
51 #define FONT_ASCII_LEFT ((char)'<')
52 #define FONT_ASCII_RIGHT ((char)'>')
54 #define MAP_FONT_ASCII(c) ((c) >= 'a' && (c) <= 'z' ? 'A' + (c) - 'a' : \
55 (c) == CHAR_BYTE_COPYRIGHT ? 96 : \
56 (c) == CHAR_BYTE_UMLAUT_a ? 97 : \
57 (c) == CHAR_BYTE_UMLAUT_A ? 97 : \
58 (c) == CHAR_BYTE_UMLAUT_o ? 98 : \
59 (c) == CHAR_BYTE_UMLAUT_O ? 98 : \
60 (c) == CHAR_BYTE_UMLAUT_u ? 99 : \
61 (c) == CHAR_BYTE_UMLAUT_U ? 99 : \
62 (c) == CHAR_BYTE_DEGREE ? 100 : \
63 (c) == CHAR_BYTE_REGISTERED ? 101 : \
64 (c) == FONT_ASCII_CURSOR ? 102 : \
65 (c) == FONT_ASCII_BUTTON ? 109 : \
66 (c) == FONT_ASCII_UP ? 110 : \
67 (c) == FONT_ASCII_DOWN ? 111 : \
70 #define MAP_FONT_ASCII_EXT(c) ((c) == CHAR_BYTE_COPYRIGHT ? 128 : \
71 (c) == CHAR_BYTE_UMLAUT_A ? 129 : \
72 (c) == CHAR_BYTE_UMLAUT_O ? 130 : \
73 (c) == CHAR_BYTE_UMLAUT_U ? 131 : \
74 (c) == CHAR_BYTE_DEGREE ? 132 : \
75 (c) == CHAR_BYTE_REGISTERED ? 133 : \
76 (c) == FONT_ASCII_CURSOR ? 134 : \
77 (c) == CHAR_BYTE_UMLAUT_a ? 135 : \
78 (c) == CHAR_BYTE_UMLAUT_o ? 136 : \
79 (c) == CHAR_BYTE_UMLAUT_u ? 137 : \
80 (c) == CHAR_BYTE_SHARP_S ? 138 : \
81 (c) == FONT_ASCII_BUTTON ? 141 : \
82 (c) == FONT_ASCII_UP ? 142 : \
83 (c) == FONT_ASCII_DOWN ? 143 : \
86 // 64 regular ordered ASCII characters, 6 special characters, 1 cursor char.
87 #define MIN_NUM_CHARS_PER_FONT 64
88 #define NUM_CHARS_PER_FONT_EXT 112
89 #define DEFAULT_NUM_CHARS_PER_FONT (MIN_NUM_CHARS_PER_FONT + 6 +1)
90 #define DEFAULT_NUM_CHARS_PER_LINE 16
93 // font structure definitions
95 void EnableDrawingText(void);
96 void DisableDrawingText(void);
98 void InitFontInfo(struct FontBitmapInfo *, int,
99 int (*function1)(int),
100 int (*function2)(char *),
101 char * (*function3)(int));
102 void FreeFontInfo(struct FontBitmapInfo *);
104 struct FontBitmapInfo *getFontBitmapInfo(int);
106 int getFontWidth(int);
107 int getFontHeight(int);
108 int getFontDrawOffsetX(int);
109 int getFontDrawOffsetY(int);
110 int getTextWidth(char *, int);
112 void getFontCharSource(int, char, Bitmap **, int *, int *);
114 int maxWordLengthInRequestString(char *);
116 void DrawInitText(char *, int, int);
117 void DrawInitTextHead(char *);
118 void DrawInitTextItem(char *);
120 void DrawTextF(int, int, int, char *, ...);
121 void DrawTextFCentered(int, int, char *, ...);
122 void DrawTextS(int, int, int, char *);
123 void DrawTextSCentered(int, int, char *);
124 void DrawTextSAligned(int, int, char *, int, int);
125 void DrawText(int, int, char *, int);
126 void DrawTextExt(DrawBuffer *, int, int, char *, int, int);
128 char *GetTextBufferFromFile(char *, int);
129 int DrawTextArea(int, int, char *, int, int, int, int, int, int,
130 boolean, boolean, boolean);
131 int DrawTextBuffer(int, int, char *, int, int, int, int, int, int,
132 boolean, boolean, boolean);
133 int DrawTextBufferS(int, int, char *, int, int, int, int, int, int,
134 boolean, boolean, boolean);
135 int DrawTextBufferVA(int, int, char *, va_list, int, int, int, int, int, int,
136 boolean, boolean, boolean);
137 int DrawTextFile(int, int, char *, int, int, int, int, int, int,
138 boolean, boolean, boolean);