1 // ============================================================================
2 // Artsoft Retro-Game Library
3 // ----------------------------------------------------------------------------
4 // (c) 1995-2014 by Artsoft Entertainment
7 // http://www.artsoft.org/
8 // ----------------------------------------------------------------------------
10 // ============================================================================
19 #define FONT_INITIAL_1 0
20 #define FONT_INITIAL_2 1
21 #define FONT_INITIAL_3 2
22 #define FONT_INITIAL_4 3
25 #define FC_RED FONT_INITIAL_1
26 #define FC_BLUE FONT_INITIAL_2
27 #define FC_GREEN FONT_INITIAL_3
28 #define FC_YELLOW 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 /* 64 regular ordered ASCII characters, 6 special characters, 1 cursor char. */
71 #define MIN_NUM_CHARS_PER_FONT 64
72 #define DEFAULT_NUM_CHARS_PER_FONT (MIN_NUM_CHARS_PER_FONT + 6 +1)
73 #define DEFAULT_NUM_CHARS_PER_LINE 16
76 /* font structure definitions */
78 void InitFontInfo(struct FontBitmapInfo *, int,
79 int (*function1)(int), int (*function2)(char *));
80 void FreeFontInfo(struct FontBitmapInfo *);
82 struct FontBitmapInfo *getFontBitmapInfo(int);
84 int getFontWidth(int);
85 int getFontHeight(int);
86 int getTextWidth(char *, int);
88 void getFontCharSource(int, char, Bitmap **, int *, int *);
90 int maxWordLengthInString(char *);
92 void DrawInitText(char *, int, int);
94 void DrawTextF(int, int, int, char *, ...);
95 void DrawTextFCentered(int, int, char *, ...);
96 void DrawTextS(int, int, int, char *);
97 void DrawTextSCentered(int, int, char *);
98 void DrawTextCentered(int, int, char *);
99 void DrawTextSAligned(int, int, char *, int, int);
100 void DrawTextAligned(int, int, char *, int, int);
101 void DrawText(int, int, char *, int);
102 void DrawTextExt(DrawBuffer *, int, int, char *, int, int);
104 char *GetTextBufferFromFile(char *, int);
105 int DrawTextBuffer(int, int, char *, int, int, int, int, int, int,
106 boolean, boolean, boolean);
107 int DrawTextBufferVA(int, int, char *, va_list, int, int, int, int, int, int,
108 boolean, boolean, boolean);
109 int DrawTextFile(int, int, char *, int, int, int, int, int, int,
110 boolean, boolean, boolean);