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 // 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 EnableDrawingText(void);
79 void DisableDrawingText(void);
81 void InitFontInfo(struct FontBitmapInfo *, int,
82 int (*function1)(int),
83 int (*function2)(char *),
84 char * (*function3)(int));
85 void FreeFontInfo(struct FontBitmapInfo *);
87 struct FontBitmapInfo *getFontBitmapInfo(int);
89 int getFontWidth(int);
90 int getFontHeight(int);
91 int getFontDrawOffsetX(int);
92 int getFontDrawOffsetY(int);
93 int getTextWidth(char *, int);
95 void getFontCharSource(int, char, Bitmap **, int *, int *);
97 int maxWordLengthInRequestString(char *);
99 void DrawInitText(char *, int, int);
100 void DrawInitTextHead(char *);
101 void DrawInitTextItem(char *);
103 void DrawTextF(int, int, int, char *, ...);
104 void DrawTextFCentered(int, int, char *, ...);
105 void DrawTextS(int, int, int, char *);
106 void DrawTextSCentered(int, int, char *);
107 void DrawTextSAligned(int, int, char *, int, int);
108 void DrawText(int, int, char *, int);
109 void DrawTextExt(DrawBuffer *, int, int, char *, int, int);
111 char *GetTextBufferFromFile(char *, int);
112 int DrawTextArea(int, int, char *, int, int, int, int, int, int,
113 boolean, boolean, boolean);
114 int DrawTextBuffer(int, int, char *, int, int, int, int, int, int,
115 boolean, boolean, boolean);
116 int DrawTextBufferS(int, int, char *, int, int, int, int, int, int,
117 boolean, boolean, boolean);
118 int DrawTextBufferVA(int, int, char *, va_list, int, int, int, int, int, int,
119 boolean, boolean, boolean);
120 int DrawTextFile(int, int, char *, int, int, int, int, int, int,
121 boolean, boolean, boolean);