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 character mapping for default fonts */
34 #define FONT_ASCII_CURSOR ((char)160)
35 #define FONT_ASCII_BUTTON ((char)128)
36 #define FONT_ASCII_UP ((char)129)
37 #define FONT_ASCII_DOWN ((char)130)
38 #define FONT_ASCII_LEFT ((char)'<')
39 #define FONT_ASCII_RIGHT ((char)'>')
41 #define MAP_FONT_ASCII(c) ((c) >= 'a' && (c) <= 'z' ? 'A' + (c) - 'a' : \
43 (c) == 'ä' || (c) == 'Ä' ? 97 : \
44 (c) == 'ö' || (c) == 'Ö' ? 98 : \
45 (c) == 'ü' || (c) == 'Ü' ? 99 : \
48 (c) == FONT_ASCII_CURSOR ? 102 : \
49 (c) == FONT_ASCII_BUTTON ? 109 : \
50 (c) == FONT_ASCII_UP ? 110 : \
51 (c) == FONT_ASCII_DOWN ? 111 : \
54 /* 64 regular ordered ASCII characters, 6 special characters, 1 cursor char. */
55 #define MIN_NUM_CHARS_PER_FONT 64
56 #define DEFAULT_NUM_CHARS_PER_FONT (MIN_NUM_CHARS_PER_FONT + 6 +1)
57 #define DEFAULT_NUM_CHARS_PER_LINE 16
60 /* font structure definitions */
62 void InitFontInfo(struct FontBitmapInfo *, int,
63 int (*function1)(int), int (*function2)(char *));
64 void FreeFontInfo(struct FontBitmapInfo *);
66 struct FontBitmapInfo *getFontBitmapInfo(int);
68 int getFontWidth(int);
69 int getFontHeight(int);
70 int getTextWidth(char *, int);
72 void getFontCharSource(int, char, Bitmap **, int *, int *);
74 int maxWordLengthInString(char *);
76 void DrawInitText(char *, int, int);
77 void DrawInitTextAlways(char *, int, int);
78 void DrawInitTextIfNeeded(char *, int, int);
79 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);
91 char *GetTextBufferFromFile(char *, int);
92 int DrawTextBuffer(int, int, char *, int, int, int, int, int, int,
93 boolean, boolean, boolean);
94 int DrawTextBufferVA(int, int, char *, va_list, int, int, int, int, int, int,
95 boolean, boolean, boolean);
96 int DrawTextFile(int, int, char *, int, int, int, int, int, int,
97 boolean, boolean, boolean);