1 /* ______ ___ ___
2 * /\ _ \ /\_ \ /\_ \
3 * \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
4 * \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
5 * \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
6 * \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
7 * \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
8 * /\____/
9 * \_/__/
10 *
11 * The default 8x8 font, and mono and color font vtables.
12 *
13 * Contains characters:
14 *
15 * ASCII (0x0020 to 0x007F)
16 * Latin-1 (0x00A1 to 0x00FF)
17 * Extended-A (0x0100 to 0x017F)
18 * Euro (0x20AC)
19 *
20 * Elias Pschernig added the Euro character.
21 *
22 * See readme.txt for copyright information.
23 */
24
25 #include <string.h>
26 #include "allegro.h"
27 #include "allegro/internal/aintern.h"
28
29
30
31 /* standard ASCII characters (0x20 to 0x7F) */
32 static FONT_GLYPH f_0x20 = { 8, 8, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
33 static FONT_GLYPH f_0x21 = { 8, 8, { 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00 } };
34 static FONT_GLYPH f_0x22 = { 8, 8, { 0x6C, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00 } };
35 static FONT_GLYPH f_0x23 = { 8, 8, { 0x6C, 0x6C, 0xFE, 0x6C, 0xFE, 0x6C, 0x6C, 0x00 } };
36 static FONT_GLYPH f_0x24 = { 8, 8, { 0x18, 0x7E, 0xC0, 0x7C, 0x06, 0xFC, 0x18, 0x00 } };
37 static FONT_GLYPH f_0x25 = { 8, 8, { 0x00, 0xC6, 0xCC, 0x18, 0x30, 0x66, 0xC6, 0x00 } };
38 static FONT_GLYPH f_0x26 = { 8, 8, { 0x38, 0x6C, 0x38, 0x76, 0xDC, 0xCC, 0x76, 0x00 } };
39 static FONT_GLYPH f_0x27 = { 8, 8, { 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 } };
40 static FONT_GLYPH f_0x28 = { 8, 8, { 0x18, 0x30, 0x60, 0x60, 0x60, 0x30, 0x18, 0x00 } };
41 static FONT_GLYPH f_0x29 = { 8, 8, { 0x60, 0x30, 0x18, 0x18, 0x18, 0x30, 0x60, 0x00 } };
42 static FONT_GLYPH f_0x2A = { 8, 8, { 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00 } };
43 static FONT_GLYPH f_0x2B = { 8, 8, { 0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00 } };
44 static FONT_GLYPH f_0x2C = { 8, 8, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30 } };
45 static FONT_GLYPH f_0x2D = { 8, 8, { 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00 } };
46 static FONT_GLYPH f_0x2E = { 8, 8, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00 } };
47 static FONT_GLYPH f_0x2F = { 8, 8, { 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x80, 0x00 } };
48 static FONT_GLYPH f_0x30 = { 8, 8, { 0x7C, 0xCE, 0xDE, 0xF6, 0xE6, 0xC6, 0x7C, 0x00 } };
49 static FONT_GLYPH f_0x31 = { 8, 8, { 0x30, 0x70, 0x30, 0x30, 0x30, 0x30, 0xFC, 0x00 } };
50 static FONT_GLYPH f_0x32 = { 8, 8, { 0x78, 0xCC, 0x0C, 0x38, 0x60, 0xCC, 0xFC, 0x00 } };
51 static FONT_GLYPH f_0x33 = { 8, 8, { 0x78, 0xCC, 0x0C, 0x38, 0x0C, 0xCC, 0x78, 0x00 } };
52 static FONT_GLYPH f_0x34 = { 8, 8, { 0x1C, 0x3C, 0x6C, 0xCC, 0xFE, 0x0C, 0x1E, 0x00 } };
53 static FONT_GLYPH f_0x35 = { 8, 8, { 0xFC, 0xC0, 0xF8, 0x0C, 0x0C, 0xCC, 0x78, 0x00 } };
54 static FONT_GLYPH f_0x36 = { 8, 8, { 0x38, 0x60, 0xC0, 0xF8, 0xCC, 0xCC, 0x78, 0x00 } };
55 static FONT_GLYPH f_0x37 = { 8, 8, { 0xFC, 0xCC, 0x0C, 0x18, 0x30, 0x30, 0x30, 0x00 } };
56 static FONT_GLYPH f_0x38 = { 8, 8, { 0x78, 0xCC, 0xCC, 0x78, 0xCC, 0xCC, 0x78, 0x00 } };
57 static FONT_GLYPH f_0x39 = { 8, 8, { 0x78, 0xCC, 0xCC, 0x7C, 0x0C, 0x18, 0x70, 0x00 } };
58 static FONT_GLYPH f_0x3A = { 8, 8, { 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00 } };
59 static FONT_GLYPH f_0x3B = { 8, 8, { 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x30 } };
60 static FONT_GLYPH f_0x3C = { 8, 8, { 0x18, 0x30, 0x60, 0xC0, 0x60, 0x30, 0x18, 0x00 } };
61 static FONT_GLYPH f_0x3D = { 8, 8, { 0x00, 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x00, 0x00 } };
62 static FONT_GLYPH f_0x3E = { 8, 8, { 0x60, 0x30, 0x18, 0x0C, 0x18, 0x30, 0x60, 0x00 } };
63 static FONT_GLYPH f_0x3F = { 8, 8, { 0x3C, 0x66, 0x0C, 0x18, 0x18, 0x00, 0x18, 0x00 } };
64 static FONT_GLYPH f_0x40 = { 8, 8, { 0x7C, 0xC6, 0xDE, 0xDE, 0xDC, 0xC0, 0x7C, 0x00 } };
65 static FONT_GLYPH f_0x41 = { 8, 8, { 0x30, 0x78, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, 0x00 } };
66 static FONT_GLYPH f_0x42 = { 8, 8, { 0xFC, 0x66, 0x66, 0x7C, 0x66, 0x66, 0xFC, 0x00 } };
67 static FONT_GLYPH f_0x43 = { 8, 8, { 0x3C, 0x66, 0xC0, 0xC0, 0xC0, 0x66, 0x3C, 0x00 } };
68 static FONT_GLYPH f_0x44 = { 8, 8, { 0xF8, 0x6C, 0x66, 0x66, 0x66, 0x6C, 0xF8, 0x00 } };
69 static FONT_GLYPH f_0x45 = { 8, 8, { 0xFE, 0x62, 0x68, 0x78, 0x68, 0x62, 0xFE, 0x00 } };
70 static FONT_GLYPH f_0x46 = { 8, 8, { 0xFE, 0x62, 0x68, 0x78, 0x68, 0x60, 0xF0, 0x00 } };
71 static FONT_GLYPH f_0x47 = { 8, 8, { 0x3C, 0x66, 0xC0, 0xC0, 0xCE, 0x66, 0x3A, 0x00 } };
72 static FONT_GLYPH f_0x48 = { 8, 8, { 0xCC, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, 0xCC, 0x00 } };
73 static FONT_GLYPH f_0x49 = { 8, 8, { 0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00 } };
74 static FONT_GLYPH f_0x4A = { 8, 8, { 0x1E, 0x0C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78, 0x00 } };
75 static FONT_GLYPH f_0x4B = { 8, 8, { 0xE6, 0x66, 0x6C, 0x78, 0x6C, 0x66, 0xE6, 0x00 } };
76 static FONT_GLYPH f_0x4C = { 8, 8, { 0xF0, 0x60, 0x60, 0x60, 0x62, 0x66, 0xFE, 0x00 } };
77 static FONT_GLYPH f_0x4D = { 8, 8, { 0xC6, 0xEE, 0xFE, 0xFE, 0xD6, 0xC6, 0xC6, 0x00 } };
78 static FONT_GLYPH f_0x4E = { 8, 8, { 0xC6, 0xE6, 0xF6, 0xDE, 0xCE, 0xC6, 0xC6, 0x00 } };
79 static FONT_GLYPH f_0x4F = { 8, 8, { 0x38, 0x6C, 0xC6, 0xC6, 0xC6, 0x6C, 0x38, 0x00 } };
80 static FONT_GLYPH f_0x50 = { 8, 8, { 0xFC, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xF0, 0x00 } };
81 static FONT_GLYPH f_0x51 = { 8, 8, { 0x7C, 0xC6, 0xC6, 0xC6, 0xD6, 0x7C, 0x0E, 0x00 } };
82 static FONT_GLYPH f_0x52 = { 8, 8, { 0xFC, 0x66, 0x66, 0x7C, 0x6C, 0x66, 0xE6, 0x00 } };
83 static FONT_GLYPH f_0x53 = { 8, 8, { 0x7C, 0xC6, 0xE0, 0x78, 0x0E, 0xC6, 0x7C, 0x00 } };
84 static FONT_GLYPH f_0x54 = { 8, 8, { 0xFC, 0xB4, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00 } };
85 static FONT_GLYPH f_0x55 = { 8, 8, { 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xFC, 0x00 } };
86 static FONT_GLYPH f_0x56 = { 8, 8, { 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x00 } };
87 static FONT_GLYPH f_0x57 = { 8, 8, { 0xC6, 0xC6, 0xC6, 0xC6, 0xD6, 0xFE, 0x6C, 0x00 } };
88 static FONT_GLYPH f_0x58 = { 8, 8, { 0xC6, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0xC6, 0x00 } };
89 static FONT_GLYPH f_0x59 = { 8, 8, { 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x30, 0x78, 0x00 } };
90 static FONT_GLYPH f_0x5A = { 8, 8, { 0xFE, 0xC6, 0x8C, 0x18, 0x32, 0x66, 0xFE, 0x00 } };
91 static FONT_GLYPH f_0x5B = { 8, 8, { 0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x78, 0x00 } };
92 static FONT_GLYPH f_0x5C = { 8, 8, { 0xC0, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x02, 0x00 } };
93 static FONT_GLYPH f_0x5D = { 8, 8, { 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00 } };
94 static FONT_GLYPH f_0x5E = { 8, 8, { 0x10, 0x38, 0x6C, 0xC6, 0x00, 0x00, 0x00, 0x00 } };
95 static FONT_GLYPH f_0x5F = { 8, 8, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF } };
96 static FONT_GLYPH f_0x60 = { 8, 8, { 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00 } };
97 static FONT_GLYPH f_0x61 = { 8, 8, { 0x00, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00 } };
98 static FONT_GLYPH f_0x62 = { 8, 8, { 0xE0, 0x60, 0x60, 0x7C, 0x66, 0x66, 0xDC, 0x00 } };
99 static FONT_GLYPH f_0x63 = { 8, 8, { 0x00, 0x00, 0x78, 0xCC, 0xC0, 0xCC, 0x78, 0x00 } };
100 static FONT_GLYPH f_0x64 = { 8, 8, { 0x1C, 0x0C, 0x0C, 0x7C, 0xCC, 0xCC, 0x76, 0x00 } };
101 static FONT_GLYPH f_0x65 = { 8, 8, { 0x00, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00 } };
102 static FONT_GLYPH f_0x66 = { 8, 8, { 0x38, 0x6C, 0x64, 0xF0, 0x60, 0x60, 0xF0, 0x00 } };
103 static FONT_GLYPH f_0x67 = { 8, 8, { 0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8 } };
104 static FONT_GLYPH f_0x68 = { 8, 8, { 0xE0, 0x60, 0x6C, 0x76, 0x66, 0x66, 0xE6, 0x00 } };
105 static FONT_GLYPH f_0x69 = { 8, 8, { 0x30, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00 } };
106 static FONT_GLYPH f_0x6A = { 8, 8, { 0x0C, 0x00, 0x1C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78 } };
107 static FONT_GLYPH f_0x6B = { 8, 8, { 0xE0, 0x60, 0x66, 0x6C, 0x78, 0x6C, 0xE6, 0x00 } };
108 static FONT_GLYPH f_0x6C = { 8, 8, { 0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00 } };
109 static FONT_GLYPH f_0x6D = { 8, 8, { 0x00, 0x00, 0xCC, 0xFE, 0xFE, 0xD6, 0xD6, 0x00 } };
110 static FONT_GLYPH f_0x6E = { 8, 8, { 0x00, 0x00, 0xB8, 0xCC, 0xCC, 0xCC, 0xCC, 0x00 } };
111 static FONT_GLYPH f_0x6F = { 8, 8, { 0x00, 0x00, 0x78, 0xCC, 0xCC, 0xCC, 0x78, 0x00 } };
112 static FONT_GLYPH f_0x70 = { 8, 8, { 0x00, 0x00, 0xDC, 0x66, 0x66, 0x7C, 0x60, 0xF0 } };
113 static FONT_GLYPH f_0x71 = { 8, 8, { 0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0x1E } };
114 static FONT_GLYPH f_0x72 = { 8, 8, { 0x00, 0x00, 0xDC, 0x76, 0x62, 0x60, 0xF0, 0x00 } };
115 static FONT_GLYPH f_0x73 = { 8, 8, { 0x00, 0x00, 0x7C, 0xC0, 0x70, 0x1C, 0xF8, 0x00 } };
116 static FONT_GLYPH f_0x74 = { 8, 8, { 0x10, 0x30, 0xFC, 0x30, 0x30, 0x34, 0x18, 0x00 } };
117 static FONT_GLYPH f_0x75 = { 8, 8, { 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00 } };
118 static FONT_GLYPH f_0x76 = { 8, 8, { 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x00 } };
119 static FONT_GLYPH f_0x77 = { 8, 8, { 0x00, 0x00, 0xC6, 0xC6, 0xD6, 0xFE, 0x6C, 0x00 } };
120 static FONT_GLYPH f_0x78 = { 8, 8, { 0x00, 0x00, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0x00 } };
121 static FONT_GLYPH f_0x79 = { 8, 8, { 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8 } };
122 static FONT_GLYPH f_0x7A = { 8, 8, { 0x00, 0x00, 0xFC, 0x98, 0x30, 0x64, 0xFC, 0x00 } };
123 static FONT_GLYPH f_0x7B = { 8, 8, { 0x1C, 0x30, 0x30, 0xE0, 0x30, 0x30, 0x1C, 0x00 } };
124 static FONT_GLYPH f_0x7C = { 8, 8, { 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00 } };
125 static FONT_GLYPH f_0x7D = { 8, 8, { 0xE0, 0x30, 0x30, 0x1C, 0x30, 0x30, 0xE0, 0x00 } };
126 static FONT_GLYPH f_0x7E = { 8, 8, { 0x76, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
127 static FONT_GLYPH f_0x7F = { 8, 8, { 0x00, 0x10, 0x38, 0x6C, 0xC6, 0xC6, 0xFE, 0x00 } };
128
129
130
131 /* list of ASCII characters */
132 static FONT_GLYPH* ascii_data[] =
133 {
134 &f_0x20, &f_0x21, &f_0x22, &f_0x23, &f_0x24, &f_0x25, &f_0x26, &f_0x27,
135 &f_0x28, &f_0x29, &f_0x2A, &f_0x2B, &f_0x2C, &f_0x2D, &f_0x2E, &f_0x2F,
136 &f_0x30, &f_0x31, &f_0x32, &f_0x33, &f_0x34, &f_0x35, &f_0x36, &f_0x37,
137 &f_0x38, &f_0x39, &f_0x3A, &f_0x3B, &f_0x3C, &f_0x3D, &f_0x3E, &f_0x3F,
138 &f_0x40, &f_0x41, &f_0x42, &f_0x43, &f_0x44, &f_0x45, &f_0x46, &f_0x47,
139 &f_0x48, &f_0x49, &f_0x4A, &f_0x4B, &f_0x4C, &f_0x4D, &f_0x4E, &f_0x4F,
140 &f_0x50, &f_0x51, &f_0x52, &f_0x53, &f_0x54, &f_0x55, &f_0x56, &f_0x57,
141 &f_0x58, &f_0x59, &f_0x5A, &f_0x5B, &f_0x5C, &f_0x5D, &f_0x5E, &f_0x5F,
142 &f_0x60, &f_0x61, &f_0x62, &f_0x63, &f_0x64, &f_0x65, &f_0x66, &f_0x67,
143 &f_0x68, &f_0x69, &f_0x6A, &f_0x6B, &f_0x6C, &f_0x6D, &f_0x6E, &f_0x6F,
144 &f_0x70, &f_0x71, &f_0x72, &f_0x73, &f_0x74, &f_0x75, &f_0x76, &f_0x77,
145 &f_0x78, &f_0x79, &f_0x7A, &f_0x7B, &f_0x7C, &f_0x7D, &f_0x7E, &f_0x7F
146 };
147
148
149
150 /* ANSI Latin-1 characters (0xA1 to 0xFF) */
151 static FONT_GLYPH f_0xA1 = { 8, 8, { 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00 } };
152 static FONT_GLYPH f_0xA2 = { 8, 8, { 0x18, 0x18, 0x7E, 0xC0, 0xC0, 0x7E, 0x18, 0x18 } };
153 static FONT_GLYPH f_0xA3 = { 8, 8, { 0x38, 0x6C, 0x64, 0xF0, 0x60, 0xE6, 0xFC, 0x00 } };
154 static FONT_GLYPH f_0xA4 = { 8, 8, { 0x00, 0xC6, 0x7C, 0xC6, 0xC6, 0x7C, 0xC6, 0x00 } };
155 static FONT_GLYPH f_0xA5 = { 8, 8, { 0xCC, 0xCC, 0x78, 0xFC, 0x30, 0xFC, 0x30, 0x30 } };
156 static FONT_GLYPH f_0xA6 = { 8, 8, { 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00 } };
157 static FONT_GLYPH f_0xA7 = { 8, 8, { 0x3E, 0x61, 0x3C, 0x66, 0x66, 0x3C, 0x86, 0x7C } };
158 static FONT_GLYPH f_0xA8 = { 8, 8, { 0x00, 0xC6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
159 static FONT_GLYPH f_0xA9 = { 8, 8, { 0x7E, 0x81, 0x9D, 0xA1, 0xA1, 0x9D, 0x81, 0x7E } };
160 static FONT_GLYPH f_0xAA = { 8, 8, { 0x3C, 0x6C, 0x6C, 0x3E, 0x00, 0x7E, 0x00, 0x00 } };
161 static FONT_GLYPH f_0xAB = { 8, 8, { 0x00, 0x33, 0x66, 0xCC, 0x66, 0x33, 0x00, 0x00 } };
162 static FONT_GLYPH f_0xAC = { 8, 8, { 0x00, 0x00, 0x00, 0xFC, 0x0C, 0x0C, 0x00, 0x00 } };
163 static FONT_GLYPH f_0xAD = { 8, 8, { 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00 } };
164 static FONT_GLYPH f_0xAE = { 8, 8, { 0x7E, 0x81, 0xB9, 0xA5, 0xB9, 0xA5, 0x81, 0x7E } };
165 static FONT_GLYPH f_0xAF = { 8, 8, { 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
166 static FONT_GLYPH f_0xB0 = { 8, 8, { 0x38, 0x6C, 0x6C, 0x38, 0x00, 0x00, 0x00, 0x00 } };
167 static FONT_GLYPH f_0xB1 = { 8, 8, { 0x30, 0x30, 0xFC, 0x30, 0x30, 0x00, 0xFC, 0x00 } };
168 static FONT_GLYPH f_0xB2 = { 8, 8, { 0x70, 0x18, 0x30, 0x60, 0x78, 0x00, 0x00, 0x00 } };
169 static FONT_GLYPH f_0xB3 = { 8, 8, { 0x78, 0x0C, 0x38, 0x0C, 0x78, 0x00, 0x00, 0x00 } };
170 static FONT_GLYPH f_0xB4 = { 8, 8, { 0x0C, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00 } };
171 static FONT_GLYPH f_0xB5 = { 8, 8, { 0x00, 0x00, 0x33, 0x33, 0x66, 0x7E, 0xC0, 0x80 } };
172 static FONT_GLYPH f_0xB6 = { 8, 8, { 0x7F, 0xDB, 0xDB, 0x7B, 0x1B, 0x1B, 0x1B, 0x00 } };
173 static FONT_GLYPH f_0xB7 = { 8, 8, { 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00 } };
174 static FONT_GLYPH f_0xB8 = { 8, 8, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0C, 0x38 } };
175 static FONT_GLYPH f_0xB9 = { 8, 8, { 0x18, 0x38, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00 } };
176 static FONT_GLYPH f_0xBA = { 8, 8, { 0x38, 0x6C, 0x6C, 0x38, 0x00, 0x7C, 0x00, 0x00 } };
177 static FONT_GLYPH f_0xBB = { 8, 8, { 0x00, 0xCC, 0x66, 0x33, 0x66, 0xCC, 0x00, 0x00 } };
178 static FONT_GLYPH f_0xBC = { 8, 8, { 0xC3, 0xC6, 0xCC, 0xDB, 0x37, 0x6F, 0xCF, 0x03 } };
179 static FONT_GLYPH f_0xBD = { 8, 8, { 0xC3, 0xC6, 0xCC, 0xDE, 0x33, 0x66, 0xCC, 0x0F } };
180 static FONT_GLYPH f_0xBE = { 8, 8, { 0xE1, 0x32, 0xE4, 0x3A, 0xF6, 0x2A, 0x5F, 0x86 } };
181 static FONT_GLYPH f_0xBF = { 8, 8, { 0x30, 0x00, 0x30, 0x60, 0xC0, 0xCC, 0x78, 0x00 } };
182 static FONT_GLYPH f_0xC0 = { 8, 8, { 0x18, 0x0C, 0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0x00 } };
183 static FONT_GLYPH f_0xC1 = { 8, 8, { 0x30, 0x60, 0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0x00 } };
184 static FONT_GLYPH f_0xC2 = { 8, 8, { 0x7C, 0x82, 0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0x00 } };
185 static FONT_GLYPH f_0xC3 = { 8, 8, { 0x76, 0xDC, 0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0x00 } };
186 static FONT_GLYPH f_0xC4 = { 8, 8, { 0xC6, 0x00, 0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0x00 } };
187 static FONT_GLYPH f_0xC5 = { 8, 8, { 0x10, 0x28, 0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0x00 } };
188 static FONT_GLYPH f_0xC6 = { 8, 8, { 0x3E, 0x6C, 0xCC, 0xFE, 0xCC, 0xCC, 0xCE, 0x00 } };
189 static FONT_GLYPH f_0xC7 = { 8, 8, { 0x78, 0xCC, 0xC0, 0xCC, 0x78, 0x18, 0x0C, 0x78 } };
190 static FONT_GLYPH f_0xC8 = { 8, 8, { 0x30, 0x18, 0xFE, 0xC0, 0xFC, 0xC0, 0xFE, 0x00 } };
191 static FONT_GLYPH f_0xC9 = { 8, 8, { 0x0C, 0x18, 0xFE, 0xC0, 0xFC, 0xC0, 0xFE, 0x00 } };
192 static FONT_GLYPH f_0xCA = { 8, 8, { 0x7C, 0x82, 0xFE, 0xC0, 0xFC, 0xC0, 0xFE, 0x00 } };
193 static FONT_GLYPH f_0xCB = { 8, 8, { 0xC6, 0x00, 0xFE, 0xC0, 0xFC, 0xC0, 0xFE, 0x00 } };
194 static FONT_GLYPH f_0xCC = { 8, 8, { 0x30, 0x18, 0x3C, 0x18, 0x18, 0x18, 0x3C, 0x00 } };
195 static FONT_GLYPH f_0xCD = { 8, 8, { 0x0C, 0x18, 0x3C, 0x18, 0x18, 0x18, 0x3C, 0x00 } };
196 static FONT_GLYPH f_0xCE = { 8, 8, { 0x3C, 0x42, 0x3C, 0x18, 0x18, 0x18, 0x3C, 0x00 } };
197 static FONT_GLYPH f_0xCF = { 8, 8, { 0x66, 0x00, 0x3C, 0x18, 0x18, 0x18, 0x3C, 0x00 } };
198 static FONT_GLYPH f_0xD0 = { 8, 8, { 0xF8, 0x6C, 0x66, 0xF6, 0x66, 0x6C, 0xF8, 0x00 } };
199 static FONT_GLYPH f_0xD1 = { 8, 8, { 0xFC, 0x00, 0xCC, 0xEC, 0xFC, 0xDC, 0xCC, 0x00 } };
200 static FONT_GLYPH f_0xD2 = { 8, 8, { 0x30, 0x18, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x00 } };
201 static FONT_GLYPH f_0xD3 = { 8, 8, { 0x18, 0x30, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x00 } };
202 static FONT_GLYPH f_0xD4 = { 8, 8, { 0x7C, 0x82, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x00 } };
203 static FONT_GLYPH f_0xD5 = { 8, 8, { 0x76, 0xDC, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x00 } };
204 static FONT_GLYPH f_0xD6 = { 8, 8, { 0xC6, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x00 } };
205 static FONT_GLYPH f_0xD7 = { 8, 8, { 0x00, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0x00, 0x00 } };
206 static FONT_GLYPH f_0xD8 = { 8, 8, { 0x3A, 0x6C, 0xCE, 0xD6, 0xE6, 0x6C, 0xB8, 0x00 } };
207 static FONT_GLYPH f_0xD9 = { 8, 8, { 0x60, 0x30, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00 } };
208 static FONT_GLYPH f_0xDA = { 8, 8, { 0x18, 0x30, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00 } };
209 static FONT_GLYPH f_0xDB = { 8, 8, { 0x7C, 0x82, 0x00, 0xC6, 0xC6, 0xC6, 0x7C, 0x00 } };
210 static FONT_GLYPH f_0xDC = { 8, 8, { 0xC6, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00 } };
211 static FONT_GLYPH f_0xDD = { 8, 8, { 0x0C, 0x18, 0x66, 0x66, 0x3C, 0x18, 0x3C, 0x00 } };
212 static FONT_GLYPH f_0xDE = { 8, 8, { 0xE0, 0x60, 0x7C, 0x66, 0x66, 0x7C, 0x60, 0xF0 } };
213 static FONT_GLYPH f_0xDF = { 8, 8, { 0x78, 0xCC, 0xCC, 0xD8, 0xCC, 0xC6, 0xCC, 0x00 } };
214 static FONT_GLYPH f_0xE0 = { 8, 8, { 0xE0, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x7E, 0x00 } };
215 static FONT_GLYPH f_0xE1 = { 8, 8, { 0x1C, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x7E, 0x00 } };
216 static FONT_GLYPH f_0xE2 = { 8, 8, { 0x7E, 0xC3, 0x3C, 0x06, 0x3E, 0x66, 0x3F, 0x00 } };
217 static FONT_GLYPH f_0xE3 = { 8, 8, { 0x76, 0xDC, 0x78, 0x0C, 0x7C, 0xCC, 0x7E, 0x00 } };
218 static FONT_GLYPH f_0xE4 = { 8, 8, { 0xCC, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x7E, 0x00 } };
219 static FONT_GLYPH f_0xE5 = { 8, 8, { 0x30, 0x30, 0x78, 0x0C, 0x7C, 0xCC, 0x7E, 0x00 } };
220 static FONT_GLYPH f_0xE6 = { 8, 8, { 0x00, 0x00, 0x7F, 0x0C, 0x7F, 0xCC, 0x7F, 0x00 } };
221 static FONT_GLYPH f_0xE7 = { 8, 8, { 0x00, 0x00, 0x78, 0xC0, 0xC0, 0x78, 0x0C, 0x38 } };
222 static FONT_GLYPH f_0xE8 = { 8, 8, { 0xE0, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00 } };
223 static FONT_GLYPH f_0xE9 = { 8, 8, { 0x1C, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00 } };
224 static FONT_GLYPH f_0xEA = { 8, 8, { 0x7E, 0xC3, 0x3C, 0x66, 0x7E, 0x60, 0x3C, 0x00 } };
225 static FONT_GLYPH f_0xEB = { 8, 8, { 0xCC, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00 } };
226 static FONT_GLYPH f_0xEC = { 8, 8, { 0xE0, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00 } };
227 static FONT_GLYPH f_0xED = { 8, 8, { 0x38, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00 } };
228 static FONT_GLYPH f_0xEE = { 8, 8, { 0x7C, 0xC6, 0x38, 0x18, 0x18, 0x18, 0x3C, 0x00 } };
229 static FONT_GLYPH f_0xEF = { 8, 8, { 0xCC, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00 } };
230 static FONT_GLYPH f_0xF0 = { 8, 8, { 0x08, 0x3C, 0x08, 0x7C, 0xCC, 0xCC, 0x78, 0x00 } };
231 static FONT_GLYPH f_0xF1 = { 8, 8, { 0x00, 0xF8, 0x00, 0xF8, 0xCC, 0xCC, 0xCC, 0x00 } };
232 static FONT_GLYPH f_0xF2 = { 8, 8, { 0x00, 0xE0, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00 } };
233 static FONT_GLYPH f_0xF3 = { 8, 8, { 0x00, 0x1C, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00 } };
234 static FONT_GLYPH f_0xF4 = { 8, 8, { 0x78, 0xCC, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00 } };
235 static FONT_GLYPH f_0xF5 = { 8, 8, { 0x76, 0xDC, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00 } };
236 static FONT_GLYPH f_0xF6 = { 8, 8, { 0x00, 0xCC, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00 } };
237 static FONT_GLYPH f_0xF7 = { 8, 8, { 0x30, 0x30, 0x00, 0xFC, 0x00, 0x30, 0x30, 0x00 } };
238 static FONT_GLYPH f_0xF8 = { 8, 8, { 0x00, 0x02, 0x7C, 0xCE, 0xD6, 0xE6, 0x7C, 0x80 } };
239 static FONT_GLYPH f_0xF9 = { 8, 8, { 0x00, 0xE0, 0x00, 0xCC, 0xCC, 0xCC, 0x7E, 0x00 } };
240 static FONT_GLYPH f_0xFA = { 8, 8, { 0x00, 0x1C, 0x00, 0xCC, 0xCC, 0xCC, 0x7E, 0x00 } };
241 static FONT_GLYPH f_0xFB = { 8, 8, { 0x78, 0xCC, 0x00, 0xCC, 0xCC, 0xCC, 0x7E, 0x00 } };
242 static FONT_GLYPH f_0xFC = { 8, 8, { 0x00, 0xCC, 0x00, 0xCC, 0xCC, 0xCC, 0x7E, 0x00 } };
243 static FONT_GLYPH f_0xFD = { 8, 8, { 0x18, 0x30, 0xCC, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8 } };
244 static FONT_GLYPH f_0xFE = { 8, 8, { 0xF0, 0x60, 0x7C, 0x66, 0x7C, 0x60, 0xF0, 0x00 } };
245 static FONT_GLYPH f_0xFF = { 8, 8, { 0x00, 0xCC, 0x00, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8 } };
246
247
248
249 /* list of Latin-1 characters */
250 static FONT_GLYPH* latin1_data[] =
251 {
252 &f_0xA1, &f_0xA2, &f_0xA3, &f_0xA4, &f_0xA5, &f_0xA6, &f_0xA7,
253 &f_0xA8, &f_0xA9, &f_0xAA, &f_0xAB, &f_0xAC, &f_0xAD, &f_0xAE, &f_0xAF,
254 &f_0xB0, &f_0xB1, &f_0xB2, &f_0xB3, &f_0xB4, &f_0xB5, &f_0xB6, &f_0xB7,
255 &f_0xB8, &f_0xB9, &f_0xBA, &f_0xBB, &f_0xBC, &f_0xBD, &f_0xBE, &f_0xBF,
256 &f_0xC0, &f_0xC1, &f_0xC2, &f_0xC3, &f_0xC4, &f_0xC5, &f_0xC6, &f_0xC7,
257 &f_0xC8, &f_0xC9, &f_0xCA, &f_0xCB, &f_0xCC, &f_0xCD, &f_0xCE, &f_0xCF,
258 &f_0xD0, &f_0xD1, &f_0xD2, &f_0xD3, &f_0xD4, &f_0xD5, &f_0xD6, &f_0xD7,
259 &f_0xD8, &f_0xD9, &f_0xDA, &f_0xDB, &f_0xDC, &f_0xDD, &f_0xDE, &f_0xDF,
260 &f_0xE0, &f_0xE1, &f_0xE2, &f_0xE3, &f_0xE4, &f_0xE5, &f_0xE6, &f_0xE7,
261 &f_0xE8, &f_0xE9, &f_0xEA, &f_0xEB, &f_0xEC, &f_0xED, &f_0xEE, &f_0xEF,
262 &f_0xF0, &f_0xF1, &f_0xF2, &f_0xF3, &f_0xF4, &f_0xF5, &f_0xF6, &f_0xF7,
263 &f_0xF8, &f_0xF9, &f_0xFA, &f_0xFB, &f_0xFC, &f_0xFD, &f_0xFE, &f_0xFF
264 };
265
266
267
268 /* Extended-A characters (0x100 to 0x17F) */
269 static FONT_GLYPH f_0x100 = { 8, 8, { 0xFE, 0x00, 0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0x00 } };
270 static FONT_GLYPH f_0x101 = { 8, 8, { 0xFC, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x7E, 0x00 } };
271 static FONT_GLYPH f_0x102 = { 8, 8, { 0x82, 0x7C, 0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0x00 } };
272 static FONT_GLYPH f_0x103 = { 8, 8, { 0xC3, 0x7E, 0x78, 0x0C, 0x7C, 0xCC, 0x7E, 0x00 } };
273 static FONT_GLYPH f_0x104 = { 8, 8, { 0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0x1C, 0x30, 0x1E } };
274 static FONT_GLYPH f_0x105 = { 8, 8, { 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x7E, 0x30, 0x1C } };
275 static FONT_GLYPH f_0x106 = { 8, 8, { 0x0C, 0x18, 0x7C, 0xC6, 0xC0, 0xC6, 0x7C, 0x00 } };
276 static FONT_GLYPH f_0x107 = { 8, 8, { 0x1C, 0x00, 0x78, 0xCC, 0xC0, 0xCC, 0x78, 0x00 } };
277 static FONT_GLYPH f_0x108 = { 8, 8, { 0x7C, 0x82, 0x7C, 0xC6, 0xC0, 0xC6, 0x7C, 0x00 } };
278 static FONT_GLYPH f_0x109 = { 8, 8, { 0x7E, 0xC3, 0x78, 0xCC, 0xC0, 0xCC, 0x78, 0x00 } };
279 static FONT_GLYPH f_0x10A = { 8, 8, { 0x10, 0x00, 0x7C, 0xC6, 0xC0, 0xC6, 0x7C, 0x00 } };
280 static FONT_GLYPH f_0x10B = { 8, 8, { 0x10, 0x00, 0x78, 0xCC, 0xC0, 0xCC, 0x78, 0x00 } };
281 static FONT_GLYPH f_0x10C = { 8, 8, { 0x6C, 0x38, 0x7C, 0xC6, 0xC0, 0xC6, 0x7C, 0x00 } };
282 static FONT_GLYPH f_0x10D = { 8, 8, { 0x6C, 0x38, 0x78, 0xCC, 0xC0, 0xCC, 0x78, 0x00 } };
283 static FONT_GLYPH f_0x10E = { 8, 8, { 0x6C, 0x38, 0xF8, 0x66, 0x66, 0x66, 0xF8, 0x00 } };
284 static FONT_GLYPH f_0x10F = { 8, 8, { 0xBC, 0x4C, 0x0C, 0x7C, 0xCC, 0xCC, 0x76, 0x00 } };
285 static FONT_GLYPH f_0x110 = { 8, 8, { 0xF8, 0x6C, 0x66, 0xF6, 0x66, 0x6C, 0xF8, 0x00 } };
286 static FONT_GLYPH f_0x111 = { 8, 8, { 0x08, 0x3C, 0x08, 0x7C, 0xCC, 0xCC, 0x78, 0x00 } };
287 static FONT_GLYPH f_0x112 = { 8, 8, { 0xFE, 0x00, 0xFE, 0xC0, 0xFC, 0xC0, 0xFE, 0x00 } };
288 static FONT_GLYPH f_0x113 = { 8, 8, { 0xFC, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00 } };
289 static FONT_GLYPH f_0x114 = { 8, 8, { 0x6C, 0x38, 0xFE, 0xC0, 0xFC, 0xC0, 0xFE, 0x00 } };
290 static FONT_GLYPH f_0x115 = { 8, 8, { 0x6C, 0x38, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00 } };
291 static FONT_GLYPH f_0x116 = { 8, 8, { 0x10, 0x00, 0xFE, 0xC0, 0xFC, 0xC0, 0xFE, 0x00 } };
292 static FONT_GLYPH f_0x117 = { 8, 8, { 0x10, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00 } };
293 static FONT_GLYPH f_0x118 = { 8, 8, { 0xFE, 0xC0, 0xFC, 0xC0, 0xFE, 0x18, 0x30, 0x1C } };
294 static FONT_GLYPH f_0x119 = { 8, 8, { 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x38, 0x0C } };
295 static FONT_GLYPH f_0x11A = { 8, 8, { 0x6C, 0x38, 0xFE, 0xC0, 0xFC, 0xC0, 0xFE, 0x00 } };
296 static FONT_GLYPH f_0x11B = { 8, 8, { 0x6C, 0x38, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00 } };
297 static FONT_GLYPH f_0x11C = { 8, 8, { 0x7C, 0x82, 0x7C, 0xC6, 0xC0, 0xCE, 0x7E, 0x00 } };
298 static FONT_GLYPH f_0x11D = { 8, 8, { 0x7E, 0xC3, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8 } };
299 static FONT_GLYPH f_0x11E = { 8, 8, { 0x82, 0x7C, 0x7C, 0xC6, 0xC0, 0xCE, 0x7E, 0x00 } };
300 static FONT_GLYPH f_0x11F = { 8, 8, { 0xC3, 0x7E, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8 } };
301 static FONT_GLYPH f_0x120 = { 8, 8, { 0x10, 0x00, 0x7C, 0xC6, 0xC0, 0xCE, 0x7E, 0x00 } };
302 static FONT_GLYPH f_0x121 = { 8, 8, { 0x10, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8 } };
303 static FONT_GLYPH f_0x122 = { 8, 8, { 0x7C, 0xC6, 0xC0, 0xCE, 0x7E, 0x18, 0x0C, 0x78 } };
304 static FONT_GLYPH f_0x123 = { 8, 8, { 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8, 0x0C, 0x38 } };
305 static FONT_GLYPH f_0x124 = { 8, 8, { 0x78, 0x84, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, 0x00 } };
306 static FONT_GLYPH f_0x125 = { 8, 8, { 0xEE, 0x7B, 0x6C, 0x76, 0x66, 0x66, 0xE6, 0x00 } };
307 static FONT_GLYPH f_0x126 = { 8, 8, { 0xCC, 0xFE, 0xCC, 0xFC, 0xCC, 0xCC, 0xCC, 0x00 } };
308 static FONT_GLYPH f_0x127 = { 8, 8, { 0xE0, 0xFE, 0x6C, 0x76, 0x66, 0x66, 0xE6, 0x00 } };
309 static FONT_GLYPH f_0x128 = { 8, 8, { 0x76, 0xDC, 0x78, 0x30, 0x30, 0x30, 0x78, 0x00 } };
310 static FONT_GLYPH f_0x129 = { 8, 8, { 0x76, 0xDC, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00 } };
311 static FONT_GLYPH f_0x12A = { 8, 8, { 0x78, 0x00, 0x78, 0x30, 0x30, 0x30, 0x78, 0x00 } };
312 static FONT_GLYPH f_0x12B = { 8, 8, { 0x78, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00 } };
313 static FONT_GLYPH f_0x12C = { 8, 8, { 0x84, 0x78, 0x78, 0x30, 0x30, 0x30, 0x78, 0x00 } };
314 static FONT_GLYPH f_0x12D = { 8, 8, { 0xC6, 0x7C, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00 } };
315 static FONT_GLYPH f_0x12E = { 8, 8, { 0x78, 0x30, 0x30, 0x30, 0x78, 0x18, 0x30, 0x1E } };
316 static FONT_GLYPH f_0x12F = { 8, 8, { 0x30, 0x00, 0x70, 0x30, 0x30, 0x78, 0x30, 0x1C } };
317 static FONT_GLYPH f_0x130 = { 8, 8, { 0x10, 0x00, 0x78, 0x30, 0x30, 0x30, 0x78, 0x00 } };
318 static FONT_GLYPH f_0x131 = { 8, 8, { 0x00, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00 } };
319 static FONT_GLYPH f_0x132 = { 8, 8, { 0xEE, 0x42, 0x42, 0x42, 0x52, 0x52, 0xEC, 0x00 } };
320 static FONT_GLYPH f_0x133 = { 8, 8, { 0x42, 0x00, 0xC6, 0x42, 0x42, 0x42, 0xE2, 0x0C } };
321 static FONT_GLYPH f_0x134 = { 8, 8, { 0x7C, 0x82, 0x0C, 0x0C, 0xCC, 0xCC, 0x78, 0x00 } };
322 static FONT_GLYPH f_0x135 = { 8, 8, { 0x7C, 0xC6, 0x1C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78 } };
323 static FONT_GLYPH f_0x136 = { 8, 8, { 0xE6, 0x6C, 0x78, 0x6C, 0xE6, 0x30, 0x18, 0xF0 } };
324 static FONT_GLYPH f_0x137 = { 8, 8, { 0xE0, 0x66, 0x6C, 0x78, 0x6C, 0xE6, 0x30, 0xE0 } };
325 static FONT_GLYPH f_0x138 = { 8, 8, { 0x00, 0x00, 0xE6, 0x6C, 0x78, 0x6C, 0xE6, 0x00 } };
326 static FONT_GLYPH f_0x139 = { 8, 8, { 0xF3, 0x66, 0x60, 0x60, 0x62, 0x66, 0xFE, 0x00 } };
327 static FONT_GLYPH f_0x13A = { 8, 8, { 0x73, 0x36, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00 } };
328 static FONT_GLYPH f_0x13B = { 8, 8, { 0xF0, 0x60, 0x62, 0x66, 0xFE, 0x18, 0x0C, 0x78 } };
329 static FONT_GLYPH f_0x13C = { 8, 8, { 0x70, 0x30, 0x30, 0x30, 0x30, 0x78, 0x0C, 0x38 } };
330 static FONT_GLYPH f_0x13D = { 8, 8, { 0xF5, 0x66, 0x60, 0x60, 0x62, 0x66, 0xFE, 0x00 } };
331 static FONT_GLYPH f_0x13E = { 8, 8, { 0x75, 0x36, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00 } };
332 static FONT_GLYPH f_0x13F = { 8, 8, { 0xF0, 0x60, 0x64, 0x60, 0x62, 0x66, 0xFE, 0x00 } };
333 static FONT_GLYPH f_0x140 = { 8, 8, { 0x70, 0x30, 0x30, 0x32, 0x30, 0x30, 0x78, 0x00 } };
334 static FONT_GLYPH f_0x141 = { 8, 8, { 0xF0, 0x60, 0x70, 0x60, 0xE2, 0x66, 0xFE, 0x00 } };
335 static FONT_GLYPH f_0x142 = { 8, 8, { 0x70, 0x30, 0x38, 0x30, 0x70, 0x30, 0x78, 0x00 } };
336 static FONT_GLYPH f_0x143 = { 8, 8, { 0x0C, 0x18, 0xCC, 0xEC, 0xFC, 0xDC, 0xCC, 0x00 } };
337 static FONT_GLYPH f_0x144 = { 8, 8, { 0x1C, 0x00, 0xB8, 0xCC, 0xCC, 0xCC, 0xCC, 0x00 } };
338 static FONT_GLYPH f_0x145 = { 8, 8, { 0xCC, 0xEC, 0xFC, 0xDC, 0xCC, 0x30, 0x18, 0xF0 } };
339 static FONT_GLYPH f_0x146 = { 8, 8, { 0x00, 0xB8, 0xCC, 0xCC, 0xCC, 0xCC, 0x30, 0xE0 } };
340 static FONT_GLYPH f_0x147 = { 8, 8, { 0x6C, 0x38, 0xCC, 0xEC, 0xFC, 0xDC, 0xCC, 0x00 } };
341 static FONT_GLYPH f_0x148 = { 8, 8, { 0x6C, 0x38, 0xB8, 0xCC, 0xCC, 0xCC, 0xCC, 0x00 } };
342 static FONT_GLYPH f_0x149 = { 8, 8, { 0xC0, 0x80, 0x5C, 0x66, 0x66, 0x66, 0x66, 0x00 } };
343 static FONT_GLYPH f_0x14A = { 8, 8, { 0x00, 0xCC, 0xEC, 0xFC, 0xDC, 0xCC, 0x0C, 0x38 } };
344 static FONT_GLYPH f_0x14B = { 8, 8, { 0x00, 0xB8, 0xCC, 0xCC, 0xCC, 0xCC, 0x0C, 0x38 } };
345 static FONT_GLYPH f_0x14C = { 8, 8, { 0xFE, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x00 } };
346 static FONT_GLYPH f_0x14D = { 8, 8, { 0x00, 0xFC, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00 } };
347 static FONT_GLYPH f_0x14E = { 8, 8, { 0x6C, 0x38, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x00 } };
348 static FONT_GLYPH f_0x14F = { 8, 8, { 0x6C, 0x38, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00 } };
349 static FONT_GLYPH f_0x150 = { 8, 8, { 0x36, 0x6C, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x00 } };
350 static FONT_GLYPH f_0x151 = { 8, 8, { 0x36, 0x6C, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00 } };
351 static FONT_GLYPH f_0x152 = { 8, 8, { 0x7E, 0xDA, 0x88, 0x8C, 0x88, 0xDA, 0x7E, 0x00 } };
352 static FONT_GLYPH f_0x153 = { 8, 8, { 0x00, 0x00, 0x6C, 0x92, 0x9E, 0x90, 0x6C, 0x00 } };
353 static FONT_GLYPH f_0x154 = { 8, 8, { 0x0C, 0x18, 0xFC, 0x66, 0x7C, 0x6C, 0xE6, 0x00 } };
354 static FONT_GLYPH f_0x155 = { 8, 8, { 0x0C, 0x18, 0xDC, 0x76, 0x62, 0x60, 0xF0, 0x00 } };
355 static FONT_GLYPH f_0x156 = { 8, 8, { 0xFC, 0x66, 0x7C, 0x6C, 0xE6, 0x30, 0x18, 0xF0 } };
356 static FONT_GLYPH f_0x157 = { 8, 8, { 0x00, 0xDC, 0x76, 0x62, 0x60, 0xF0, 0x30, 0xE0 } };
357 static FONT_GLYPH f_0x158 = { 8, 8, { 0x6C, 0x38, 0xFC, 0x66, 0x7C, 0x6C, 0xE6, 0x00 } };
358 static FONT_GLYPH f_0x159 = { 8, 8, { 0x6C, 0x38, 0xDC, 0x76, 0x62, 0x60, 0xF0, 0x00 } };
359 static FONT_GLYPH f_0x15A = { 8, 8, { 0x0C, 0x18, 0x7C, 0xE0, 0x78, 0x0E, 0x7C, 0x00 } };
360 static FONT_GLYPH f_0x15B = { 8, 8, { 0x0C, 0x18, 0x7C, 0xC0, 0x70, 0x1C, 0xF8, 0x00 } };
361 static FONT_GLYPH f_0x15C = { 8, 8, { 0x7C, 0x82, 0x7C, 0xE0, 0x78, 0x0E, 0x7C, 0x00 } };
362 static FONT_GLYPH f_0x15D = { 8, 8, { 0x7C, 0xC6, 0x7C, 0xC0, 0x70, 0x1C, 0xF8, 0x00 } };
363 static FONT_GLYPH f_0x15E = { 8, 8, { 0x7C, 0xE0, 0x78, 0x0E, 0x7C, 0x18, 0x0C, 0x78 } };
364 static FONT_GLYPH f_0x15F = { 8, 8, { 0x00, 0x7C, 0xC0, 0x70, 0x1C, 0xF8, 0x0C, 0x38 } };
365 static FONT_GLYPH f_0x160 = { 8, 8, { 0x6C, 0x38, 0x7C, 0xE0, 0x78, 0x0E, 0x7C, 0x00 } };
366 static FONT_GLYPH f_0x161 = { 8, 8, { 0x6C, 0x38, 0x7C, 0xC0, 0x70, 0x1C, 0xF8, 0x00 } };
367 static FONT_GLYPH f_0x162 = { 8, 8, { 0xFC, 0x30, 0x30, 0x30, 0x78, 0x18, 0x0C, 0x38 } };
368 static FONT_GLYPH f_0x163 = { 8, 8, { 0x10, 0x30, 0xFC, 0x30, 0x34, 0x18, 0x0C, 0x38 } };
369 static FONT_GLYPH f_0x164 = { 8, 8, { 0x6C, 0x38, 0xFC, 0x30, 0x30, 0x30, 0x78, 0x00 } };
370 static FONT_GLYPH f_0x165 = { 8, 8, { 0x12, 0x3A, 0xFC, 0x30, 0x30, 0x34, 0x18, 0x00 } };
371 static FONT_GLYPH f_0x166 = { 8, 8, { 0xFC, 0xB4, 0x30, 0x30, 0xFC, 0x30, 0x78, 0x00 } };
372 static FONT_GLYPH f_0x167 = { 8, 8, { 0x10, 0x30, 0xFC, 0x30, 0xFC, 0x34, 0x18, 0x00 } };
373 static FONT_GLYPH f_0x168 = { 8, 8, { 0x76, 0xDC, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00 } };
374 static FONT_GLYPH f_0x169 = { 8, 8, { 0x76, 0xDC, 0x00, 0xCC, 0xCC, 0xCC, 0x7E, 0x00 } };
375 static FONT_GLYPH f_0x16A = { 8, 8, { 0xFE, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00 } };
376 static FONT_GLYPH f_0x16B = { 8, 8, { 0x00, 0xFE, 0x00, 0xCC, 0xCC, 0xCC, 0x7E, 0x00 } };
377 static FONT_GLYPH f_0x16C = { 8, 8, { 0x6C, 0x38, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00 } };
378 static FONT_GLYPH f_0x16D = { 8, 8, { 0x6C, 0x38, 0x00, 0xCC, 0xCC, 0xCC, 0x7E, 0x00 } };
379 static FONT_GLYPH f_0x16E = { 8, 8, { 0x38, 0x6C, 0xFE, 0xD6, 0xC6, 0xC6, 0x7C, 0x00 } };
380 static FONT_GLYPH f_0x16F = { 8, 8, { 0x38, 0x6C, 0x38, 0xDC, 0xCC, 0xCC, 0x7E, 0x00 } };
381 static FONT_GLYPH f_0x170 = { 8, 8, { 0x36, 0x6C, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00 } };
382 static FONT_GLYPH f_0x171 = { 8, 8, { 0x36, 0x6C, 0x00, 0xCC, 0xCC, 0xCC, 0x7E, 0x00 } };
383 static FONT_GLYPH f_0x172 = { 8, 8, { 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x30, 0x60, 0x3C } };
384 static FONT_GLYPH f_0x173 = { 8, 8, { 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0x7E, 0x18, 0x0E } };
385 static FONT_GLYPH f_0x174 = { 8, 8, { 0x7C, 0x82, 0xC6, 0xC6, 0xD6, 0xFE, 0x6C, 0x00 } };
386 static FONT_GLYPH f_0x175 = { 8, 8, { 0x7C, 0xC6, 0x00, 0xC6, 0xD6, 0xFE, 0x6C, 0x00 } };
387 static FONT_GLYPH f_0x176 = { 8, 8, { 0x7C, 0x82, 0xCC, 0xCC, 0x78, 0x30, 0x78, 0x00 } };
388 static FONT_GLYPH f_0x177 = { 8, 8, { 0x7C, 0xC6, 0xCC, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8 } };
389 static FONT_GLYPH f_0x178 = { 8, 8, { 0xCC, 0x00, 0xCC, 0xCC, 0x78, 0x30, 0x78, 0x00 } };
390 static FONT_GLYPH f_0x179 = { 8, 8, { 0x0C, 0x18, 0xFE, 0x8C, 0x18, 0x32, 0xFE, 0x00 } };
391 static FONT_GLYPH f_0x17A = { 8, 8, { 0x0C, 0x18, 0xFC, 0x98, 0x30, 0x64, 0xFC, 0x00 } };
392 static FONT_GLYPH f_0x17B = { 8, 8, { 0x10, 0x00, 0xFE, 0x8C, 0x18, 0x32, 0xFE, 0x00 } };
393 static FONT_GLYPH f_0x17C = { 8, 8, { 0x10, 0x00, 0xFC, 0x98, 0x30, 0x64, 0xFC, 0x00 } };
394 static FONT_GLYPH f_0x17D = { 8, 8, { 0x6C, 0x38, 0xFE, 0x8C, 0x18, 0x32, 0xFE, 0x00 } };
395 static FONT_GLYPH f_0x17E = { 8, 8, { 0x6C, 0x38, 0xFC, 0x98, 0x30, 0x64, 0xFC, 0x00 } };
396 static FONT_GLYPH f_0x17F = { 8, 8, { 0x38, 0x6C, 0x64, 0xE0, 0x60, 0x60, 0xE0, 0x00 } };
397
398
399
400 /* list of Extended-A characters */
401 static FONT_GLYPH* extended_a_data[] =
402 {
403 &f_0x100, &f_0x101, &f_0x102, &f_0x103, &f_0x104, &f_0x105, &f_0x106, &f_0x107,
404 &f_0x108, &f_0x109, &f_0x10A, &f_0x10B, &f_0x10C, &f_0x10D, &f_0x10E, &f_0x10F,
405 &f_0x110, &f_0x111, &f_0x112, &f_0x113, &f_0x114, &f_0x115, &f_0x116, &f_0x117,
406 &f_0x118, &f_0x119, &f_0x11A, &f_0x11B, &f_0x11C, &f_0x11D, &f_0x11E, &f_0x11F,
407 &f_0x120, &f_0x121, &f_0x122, &f_0x123, &f_0x124, &f_0x125, &f_0x126, &f_0x127,
408 &f_0x128, &f_0x129, &f_0x12A, &f_0x12B, &f_0x12C, &f_0x12D, &f_0x12E, &f_0x12F,
409 &f_0x130, &f_0x131, &f_0x132, &f_0x133, &f_0x134, &f_0x135, &f_0x136, &f_0x137,
410 &f_0x138, &f_0x139, &f_0x13A, &f_0x13B, &f_0x13C, &f_0x13D, &f_0x13E, &f_0x13F,
411 &f_0x140, &f_0x141, &f_0x142, &f_0x143, &f_0x144, &f_0x145, &f_0x146, &f_0x147,
412 &f_0x148, &f_0x149, &f_0x14A, &f_0x14B, &f_0x14C, &f_0x14D, &f_0x14E, &f_0x14F,
413 &f_0x150, &f_0x151, &f_0x152, &f_0x153, &f_0x154, &f_0x155, &f_0x156, &f_0x157,
414 &f_0x158, &f_0x159, &f_0x15A, &f_0x15B, &f_0x15C, &f_0x15D, &f_0x15E, &f_0x15F,
415 &f_0x160, &f_0x161, &f_0x162, &f_0x163, &f_0x164, &f_0x165, &f_0x166, &f_0x167,
416 &f_0x168, &f_0x169, &f_0x16A, &f_0x16B, &f_0x16C, &f_0x16D, &f_0x16E, &f_0x16F,
417 &f_0x170, &f_0x171, &f_0x172, &f_0x173, &f_0x174, &f_0x175, &f_0x176, &f_0x177,
418 &f_0x178, &f_0x179, &f_0x17A, &f_0x17B, &f_0x17C, &f_0x17D, &f_0x17E, &f_0x17F
419 };
420
421
422
423 /* euro character (0x20AC) */
424 static FONT_GLYPH f_0x20AC = { 8, 8, { 0x3C, 0x62, 0xF8, 0x60, 0xF8, 0x62, 0x3C, 0x00 } };
425
426
427
428 /* euro character */
429 static FONT_GLYPH* euro_data[] =
430 {
431 &f_0x20AC
432 };
433
434
435
436 /* allegro_404_char:
437 * This is what we render missing glyphs as.
438 */
439 int allegro_404_char = '^';
440
441
442
443 /* font_height:
444 * (mono and color vtable entry)
445 * Returns the height, in pixels of the font.
446 */
font_height(AL_CONST FONT * f)447 static int font_height(AL_CONST FONT *f)
448 {
449 ASSERT(f);
450 return f->height;
451 }
452
453
454
455 /* length:
456 * (mono and color vtable entry)
457 * Returns the length, in pixels, of a string as rendered in a font.
458 */
length(AL_CONST FONT * f,AL_CONST char * text)459 static int length(AL_CONST FONT* f, AL_CONST char* text)
460 {
461 int ch = 0, w = 0;
462 AL_CONST char* p = text;
463 ASSERT(text);
464 ASSERT(f);
465
466 while( (ch = ugetxc(&p)) ) {
467 w += f->vtable->char_length(f, ch);
468 }
469
470 return w;
471 }
472
473
474
475 /* _mono_find_glyph:
476 * Helper for mono vtable, below.
477 */
_mono_find_glyph(AL_CONST FONT * f,int ch)478 FONT_GLYPH* _mono_find_glyph(AL_CONST FONT* f, int ch)
479 {
480 FONT_MONO_DATA* mf = (FONT_MONO_DATA*)(f->data);
481
482 while(mf) {
483 if(ch >= mf->begin && ch < mf->end) return mf->glyphs[ch - mf->begin];
484 mf = mf->next;
485 }
486
487 /* if we don't find the character, then search for the missing
488 glyph, but don't get stuck in a loop. */
489 if(ch != allegro_404_char) return _mono_find_glyph(f, allegro_404_char);
490 return 0;
491 }
492
493
494
495 /* mono_char_length:
496 * (mono vtable entry)
497 * Returns the length, in pixels, of a character as rendered in a
498 * monochrome font.
499 */
mono_char_length(AL_CONST FONT * f,int ch)500 static int mono_char_length(AL_CONST FONT* f, int ch)
501 {
502 FONT_GLYPH* g = _mono_find_glyph(f, ch);
503 return g ? g->w : 0;
504 }
505
506
507
508 /* mono_render_char:
509 * (mono vtable entry)
510 * Renders a character, in a monochrome font, onto a bitmap at a given
511 * location and in given colors. Returns the character width, in pixels.
512 */
mono_render_char(AL_CONST FONT * f,int ch,int fg,int bg,BITMAP * bmp,int x,int y)513 static int mono_render_char(AL_CONST FONT* f, int ch, int fg, int bg, BITMAP* bmp, int x, int y)
514 {
515 int w = 0;
516 FONT_GLYPH* g = 0;
517
518 acquire_bitmap(bmp);
519
520 g = _mono_find_glyph(f, ch);
521 if(g) {
522 bmp->vtable->draw_glyph(bmp, g, x, y + (f->height-g->h)/2, fg, bg);
523 w = g->w;
524 }
525
526 release_bitmap(bmp);
527
528 return w;
529 }
530
531
532
533 /* mono_render:
534 * (mono vtable entry)
535 * Renders a string, in a monochrome font, onto a bitmap at a given
536 * location and in given colors.
537 */
mono_render(AL_CONST FONT * f,AL_CONST char * text,int fg,int bg,BITMAP * bmp,int x,int y)538 static void mono_render(AL_CONST FONT* f, AL_CONST char* text, int fg, int bg, BITMAP* bmp, int x, int y)
539 {
540 int ch = 0;
541 AL_CONST char* p = text;
542
543 acquire_bitmap(bmp);
544
545 while( (ch = ugetxc(&p)) ) {
546 x += f->vtable->render_char(f, ch, fg, bg, bmp, x, y);
547 }
548
549 release_bitmap(bmp);
550 }
551
552
553
554 /* mono_destroy:
555 * (mono vtable entry)
556 * Destroys a monochrome font.
557 */
mono_destroy(FONT * f)558 static void mono_destroy(FONT* f)
559 {
560 FONT_MONO_DATA* mf = 0;
561
562 if(!f) return;
563
564 mf = (FONT_MONO_DATA*)(f->data);
565 while(mf) {
566 FONT_MONO_DATA* next = mf->next;
567 int i = 0;
568
569 for(i = mf->begin; i < mf->end; i++) _AL_FREE(mf->glyphs[i - mf->begin]);
570
571 _AL_FREE(mf->glyphs);
572 _AL_FREE(mf);
573 mf = next;
574 }
575
576 _AL_FREE(f);
577 }
578
579
580
581 /* mono_get_font_ranges:
582 * (mono vtable entry)
583 * Returns the number of character ranges in a font, or -1 if that information
584 * is not available.
585 */
mono_get_font_ranges(FONT * f)586 static int mono_get_font_ranges(FONT *f)
587 {
588 FONT_MONO_DATA* mf = 0;
589 int ranges = 0;
590
591 if (!f)
592 return -1;
593
594 mf = (FONT_MONO_DATA*)(f->data);
595
596 while(mf) {
597 FONT_MONO_DATA* next = mf->next;
598
599 ranges++;
600 if (!next)
601 return ranges;
602 mf = next;
603 }
604
605 return -1;
606 }
607
608
609
610 /* mono_get_font_range_begin:
611 * (mono vtable entry)
612 * Get first character for font range. Pass -1 to get the start of the font.
613 */
mono_get_font_range_begin(FONT * f,int range)614 static int mono_get_font_range_begin(FONT* f, int range)
615 {
616 FONT_MONO_DATA* mf = 0;
617 int n;
618
619 if (!f || !f->data)
620 return -1;
621
622 if (range < 0)
623 range = 0;
624 n = 0;
625
626 mf = (FONT_MONO_DATA*)(f->data);
627 while(mf && n<=range) {
628 FONT_MONO_DATA* next = mf->next;
629
630 if (!next || range == n)
631 return mf->begin;
632 mf = next;
633 n++;
634 }
635
636 return -1;
637 }
638
639
640
641 /* mono_get_font_range_end:
642 * (mono vtable entry)
643 * Get last character for font range. Pass -1 to search the entire font.
644 */
mono_get_font_range_end(FONT * f,int range)645 static int mono_get_font_range_end(FONT* f, int range)
646 {
647 FONT_MONO_DATA* mf = 0;
648 int n;
649
650 if (!f)
651 return -1;
652
653 n = 0;
654
655 mf = (FONT_MONO_DATA*)(f->data);
656
657 while(mf && (n<=range || range==-1)) {
658 FONT_MONO_DATA* next = mf->next;
659 if (!next || range == n)
660 return mf->end - 1;
661 mf = next;
662 n++;
663 }
664
665 return -1;
666 }
667
668
669
670 /* mono_copy_glyph_range:
671 * Monochrome font helper function. Copies (part of) a glyph range
672 */
mono_copy_glyph_range(FONT_MONO_DATA * mf,int begin,int end)673 static FONT_MONO_DATA *mono_copy_glyph_range(FONT_MONO_DATA *mf, int begin, int end)
674 {
675 FONT_MONO_DATA * newmf;
676 FONT_GLYPH **gl;
677 FONT_GLYPH *g;
678 int num, c;
679
680 if (begin<mf->begin || end>mf->end)
681 return NULL;
682
683 newmf = _AL_MALLOC(sizeof *newmf);
684
685 if (!newmf)
686 return NULL;
687
688 newmf->begin = begin;
689 newmf->end = end;
690 newmf->next = NULL;
691 num = end - begin;
692
693 gl = newmf->glyphs = _AL_MALLOC(num * sizeof *gl);
694 for (c=0; c<num; c++) {
695 int sz;
696 g = mf->glyphs[begin - mf->begin + c];
697 sz = ((g->w + 7) / 8) * g->h;
698
699 gl[c] = _AL_MALLOC(sz + sizeof *(gl[c]));
700 gl[c]->w = g->w;
701 gl[c]->h = g->h;
702 memcpy(gl[c]->dat, g->dat, sz * sizeof *(g->dat));
703 }
704
705 return newmf;
706 }
707
708
709
710 /* mono_extract_font_range:
711 * (mono vtable entry)
712 * Extract a range of characters from a mono font
713 */
mono_extract_font_range(FONT * f,int begin,int end)714 static FONT *mono_extract_font_range(FONT *f, int begin, int end)
715 {
716 FONT *fontout = NULL;
717 FONT_MONO_DATA *mf, *mfin;
718 int first, last;
719
720 if (!f)
721 return NULL;
722
723 /* Special case: copy entire font */
724 if (begin==-1 && end==-1) {
725 }
726 /* Copy from the beginning */
727 else if (begin == -1 && end > mono_get_font_range_begin(f, -1)) {
728 }
729 /* Copy to the end */
730 else if (end == -1 && begin <= mono_get_font_range_end(f, -1)) {
731 }
732 /* begin cannot be bigger than end */
733 else if (begin <= end && begin != -1 && end != -1) {
734 }
735 else {
736 return NULL;
737 }
738
739 /* Get output font */
740 fontout = _AL_MALLOC(sizeof *fontout);
741
742 fontout->height = f->height;
743 fontout->vtable = f->vtable;
744 fontout->data = NULL;
745
746 /* Get real character ranges */
747 first = MAX(begin, mono_get_font_range_begin(f, -1));
748 last = (end>-1) ? MIN(end, mono_get_font_range_end(f, -1)) : mono_get_font_range_end(f, -1);
749 last++;
750
751 mf = NULL;
752 mfin = f->data;
753 while (mfin) {
754 /* Find the range that is covered by the requested range. */
755 /* Check if the requested and processed ranges at least overlap */
756 if (((first >= mfin->begin && first < mfin->end) || (last <= mfin->end && last > mfin->begin))
757 /* Check if the requested range wraps processed ranges */
758 || (first < mfin->begin && last > mfin->end)) {
759 int local_begin, local_end;
760
761 local_begin = MAX(mfin->begin, first);
762 local_end = MIN(mfin->end, last);
763
764 if (mf) {
765 mf->next = mono_copy_glyph_range(mfin, local_begin, local_end);
766 mf = mf->next;
767 }
768 else {
769 mf = mono_copy_glyph_range(mfin, local_begin, local_end);
770 fontout->data = mf;
771 }
772 }
773 mfin = mfin->next;
774 }
775
776 return fontout;
777 }
778
779
780
781 /* mono_merge_fonts:
782 * (mono vtable entry)
783 * Merges font2 with font1 and returns a new font
784 */
mono_merge_fonts(FONT * font1,FONT * font2)785 static FONT *mono_merge_fonts(FONT *font1, FONT *font2)
786 {
787 FONT *fontout = NULL;
788 FONT_MONO_DATA *mf, *mf1, *mf2;
789
790 if (!font1 || !font2)
791 return NULL;
792
793 if (!is_mono_font(font1) || !is_mono_font(font2))
794 return NULL;
795
796 /* Get output font */
797 fontout = _AL_MALLOC(sizeof *fontout);
798 fontout->height = MAX(font1->height, font2->height);
799 fontout->vtable = font1->vtable;
800 mf = fontout->data = NULL;
801
802 mf1 = font1->data;
803 mf2 = font2->data;
804 while (mf1 || mf2) {
805 if (mf1 && (!mf2 || (mf1->begin < mf2->begin))) {
806 if (mf) {
807 mf->next = mono_copy_glyph_range(mf1, mf1->begin, mf1->end);
808 mf = mf->next;
809 }
810 else {
811 mf = mono_copy_glyph_range(mf1, mf1->begin, mf1->end);
812 fontout->data = mf;
813 }
814 mf1 = mf1->next;
815 }
816 else {
817 if (mf) {
818 mf->next = mono_copy_glyph_range(mf2, mf2->begin, mf2->end);
819 mf = mf->next;
820 }
821 else {
822 mf = mono_copy_glyph_range(mf2, mf2->begin, mf2->end);
823 fontout->data = mf;
824 }
825 mf2 = mf2->next;
826 }
827 }
828
829 return fontout;
830 }
831
832
833
834 /* mono_transpose_font:
835 * (mono vtable entry)
836 * Transpose all glyphs in a font
837 */
mono_transpose_font(FONT * f,int drange)838 static int mono_transpose_font(FONT* f, int drange)
839 {
840 FONT_MONO_DATA* mf = 0;
841
842 if (!f)
843 return -1;
844
845 mf = (FONT_MONO_DATA*)(f->data);
846
847 while(mf) {
848 FONT_MONO_DATA* next = mf->next;
849
850 mf->begin += drange;
851 mf->end += drange;
852 mf = next;
853 }
854
855 return 0;
856 }
857
858
859
860 /* _color_find_glyph:
861 * Helper for color vtable entries, below.
862 */
_color_find_glyph(AL_CONST FONT * f,int ch)863 BITMAP* _color_find_glyph(AL_CONST FONT* f, int ch)
864 {
865 FONT_COLOR_DATA* cf = (FONT_COLOR_DATA*)(f->data);
866
867 while(cf) {
868 if(ch >= cf->begin && ch < cf->end) return cf->bitmaps[ch - cf->begin];
869 cf = cf->next;
870 }
871
872 /* if we don't find the character, then search for the missing
873 glyph, but don't get stuck in a loop. */
874 if(ch != allegro_404_char) return _color_find_glyph(f, allegro_404_char);
875 return 0;
876 }
877
878
879
880 /* color_char_length:
881 * (color vtable entry)
882 * Returns the length of a character, in pixels, as it would be rendered
883 * in this font.
884 */
color_char_length(AL_CONST FONT * f,int ch)885 static int color_char_length(AL_CONST FONT* f, int ch)
886 {
887 BITMAP* g = _color_find_glyph(f, ch);
888 return g ? g->w : 0;
889 }
890
891
892
893 /* color_render_char:
894 * (color vtable entry)
895 * Renders a color character onto a bitmap, at the specified location, using
896 * the specified colors. If fg == -1, render as color, else render as
897 * mono; if bg == -1, render as transparent, else render as opaque.
898 * Returns the character width, in pixels.
899 */
color_render_char(AL_CONST FONT * f,int ch,int fg,int bg,BITMAP * bmp,int x,int y)900 static int color_render_char(AL_CONST FONT* f, int ch, int fg, int bg, BITMAP* bmp, int x, int y)
901 {
902 int w = 0;
903 int h = f->vtable->font_height(f);
904 BITMAP *g = 0;
905
906 acquire_bitmap(bmp);
907
908 if(fg < 0 && bg >= 0) {
909 rectfill(bmp, x, y, x + f->vtable->char_length(f, ch) - 1, y + h - 1, bg);
910 }
911
912 g = _color_find_glyph(f, ch);
913 if(g) {
914 if (bitmap_color_depth(g) == 8) {
915 if(fg < 0) {
916 bmp->vtable->draw_256_sprite(bmp, g, x, y + (h-g->h)/2);
917 }
918 else {
919 bmp->vtable->draw_character(bmp, g, x, y + (h-g->h)/2, fg, bg);
920 }
921 }
922 else {
923 if (bitmap_color_depth(g) == bitmap_color_depth(bmp)) {
924 masked_blit(g, bmp, 0, 0, x, y + (h-g->h)/2, g->w, g->h);
925 }
926 else {
927 int color_conv_mode;
928 BITMAP *tbmp;
929 /* We need to do colour conversion - which is slow... */
930
931 color_conv_mode = get_color_conversion();
932 set_color_conversion(COLORCONV_MOST | COLORCONV_KEEP_TRANS);
933
934 tbmp = create_bitmap_ex(bitmap_color_depth(bmp), g->w, g->h);
935 blit(g, tbmp, 0, 0, 0, 0, g->w, g->h);
936
937 set_color_conversion(color_conv_mode);
938
939 masked_blit(tbmp, bmp, 0, 0, x, y + (h-g->h)/2, g->w, g->h);
940
941 destroy_bitmap(tbmp);
942 }
943 }
944
945 w = g->w;
946 }
947
948 release_bitmap(bmp);
949
950 return w;
951 }
952
953
954
955 /* trans_render_char:
956 * (trans vtable entry)
957 *
958 * Renders a transparent character onto a bitmap, at the specified location,
959 * using the specified colors. fg is ignored. if bg == -1, render as
960 * transparent, else render as opaque. Returns the character width, in pixels.
961 */
trans_render_char(AL_CONST FONT * f,int ch,int fg,int bg,BITMAP * bmp,int x,int y)962 static int trans_render_char(AL_CONST FONT* f, int ch, int fg, int bg, BITMAP* bmp, int x, int y)
963 {
964 int w = 0;
965 int h = f->vtable->font_height(f);
966 BITMAP *g = 0;
967
968 acquire_bitmap(bmp);
969
970 if(bg >= 0) {
971 rectfill(bmp, x, y, x + f->vtable->char_length(f, ch) - 1, y + h - 1, bg);
972 }
973
974 g = _color_find_glyph(f, ch);
975 if(g) {
976 draw_trans_sprite(bmp, g, x, y + (h-g->h)/2);
977 w = g->w;
978 }
979
980 release_bitmap(bmp);
981
982 return w;
983 }
984
985
986
987 /* color_render:
988 * (color vtable entry)
989 * Renders a color font onto a bitmap, at the specified location, using
990 * the specified colors. If fg == -1, render as color, else render as
991 * mono; if bg == -1, render as transparent, else render as opaque.
992 */
color_render(AL_CONST FONT * f,AL_CONST char * text,int fg,int bg,BITMAP * bmp,int x,int y)993 static void color_render(AL_CONST FONT* f, AL_CONST char* text, int fg, int bg, BITMAP* bmp, int x, int y)
994 {
995 AL_CONST char* p = text;
996 int ch = 0;
997
998 acquire_bitmap(bmp);
999
1000 if(fg < 0 && bg >= 0) {
1001 rectfill(bmp, x, y, x + text_length(f, text) - 1, y + text_height(f) - 1, bg);
1002 bg = -1; /* to avoid filling rectangles for each character */
1003 }
1004
1005 while( (ch = ugetxc(&p)) ) {
1006 x += f->vtable->render_char(f, ch, fg, bg, bmp, x, y);
1007 }
1008
1009 release_bitmap(bmp);
1010 }
1011
1012
1013
1014 /* color_destroy:
1015 * (color vtable entry)
1016 * Destroys a color font.
1017 */
color_destroy(FONT * f)1018 static void color_destroy(FONT* f)
1019 {
1020 FONT_COLOR_DATA* cf;
1021
1022 if(!f) return;
1023
1024 cf = (FONT_COLOR_DATA*)(f->data);
1025
1026 while(cf) {
1027 FONT_COLOR_DATA* next = cf->next;
1028 int i = 0;
1029
1030 for(i = cf->begin; i < cf->end; i++) destroy_bitmap(cf->bitmaps[i - cf->begin]);
1031
1032 _AL_FREE(cf->bitmaps);
1033 _AL_FREE(cf);
1034
1035 cf = next;
1036 }
1037
1038 _AL_FREE(f);
1039 }
1040
1041
1042
1043 /* color_get_font_ranges:
1044 * (color vtable entry)
1045 * Returns the number of character ranges in a font, or -1 if that information
1046 * is not available.
1047 */
color_get_font_ranges(FONT * f)1048 static int color_get_font_ranges(FONT *f)
1049 {
1050 FONT_COLOR_DATA* cf = 0;
1051 int ranges = 0;
1052
1053 if (!f)
1054 return -1;
1055
1056 cf = (FONT_COLOR_DATA*)(f->data);
1057
1058 while(cf) {
1059 FONT_COLOR_DATA* next = cf->next;
1060
1061 ranges++;
1062 if (!next)
1063 return ranges;
1064 cf = next;
1065 }
1066
1067 return -1;
1068 }
1069
1070
1071
1072 /* color_get_font_range_begin:
1073 * (color vtable entry)
1074 * Get first character for font.
1075 */
color_get_font_range_begin(FONT * f,int range)1076 static int color_get_font_range_begin(FONT* f, int range)
1077 {
1078 FONT_COLOR_DATA* cf = 0;
1079 int n;
1080
1081 if (!f || !f->data)
1082 return -1;
1083
1084 if (range < 0)
1085 range = 0;
1086 n = 0;
1087
1088 cf = (FONT_COLOR_DATA*)(f->data);
1089 while(cf && n<=range) {
1090 FONT_COLOR_DATA* next = cf->next;
1091
1092 if (!next || range == n)
1093 return cf->begin;
1094 cf = next;
1095 n++;
1096 }
1097
1098 return -1;
1099 }
1100
1101
1102
1103 /* color_get_font_range_end:
1104 * (color vtable entry)
1105 * Get last character for font range.
1106 */
color_get_font_range_end(FONT * f,int range)1107 static int color_get_font_range_end(FONT* f, int range)
1108 {
1109 FONT_COLOR_DATA* cf = 0;
1110 int n;
1111
1112 if (!f)
1113 return -1;
1114
1115 n = 0;
1116
1117 cf = (FONT_COLOR_DATA*)(f->data);
1118
1119 while(cf && (n<=range || range==-1)) {
1120 FONT_COLOR_DATA* next = cf->next;
1121 if (!next || range == n)
1122 return cf->end - 1;
1123 cf = next;
1124 n++;
1125 }
1126
1127 return -1;
1128 }
1129
1130
1131
1132 /* upgrade_to_color, upgrade_to_color_data:
1133 * Helper functions. Upgrades a monochrome font to a color font.
1134 */
upgrade_to_color_data(FONT_MONO_DATA * mf)1135 static FONT_COLOR_DATA* upgrade_to_color_data(FONT_MONO_DATA* mf)
1136 {
1137 FONT_COLOR_DATA* cf = _AL_MALLOC(sizeof *cf);
1138 BITMAP** bits = _AL_MALLOC((mf->end - mf->begin)*sizeof *bits);
1139 int i;
1140
1141 cf->begin = mf->begin;
1142 cf->end = mf->end;
1143 cf->bitmaps = bits;
1144 cf->next = 0;
1145
1146 for(i = mf->begin; i < mf->end; i++) {
1147 FONT_GLYPH* g = mf->glyphs[i - mf->begin];
1148 BITMAP* b = create_bitmap_ex(8, g->w, g->h);
1149 clear_to_color(b, 0);
1150 b->vtable->draw_glyph(b, g, 0, 0, 1, 0);
1151
1152 bits[i - mf->begin] = b;
1153 }
1154
1155 return cf;
1156 }
1157
1158
1159
upgrade_to_color(FONT * f)1160 static FONT *upgrade_to_color(FONT* f)
1161 {
1162 FONT_MONO_DATA* mf = f->data;
1163 FONT_COLOR_DATA *cf, *cf_write = 0;
1164 FONT *outf;
1165
1166 if (is_color_font(f)) return NULL;
1167 outf = _AL_MALLOC(sizeof *outf);
1168 outf->vtable = font_vtable_color;
1169 outf->height = f->height;
1170
1171 while(mf) {
1172 FONT_MONO_DATA* mf_next = mf->next;
1173
1174 cf = upgrade_to_color_data(mf);
1175 if(!cf_write) outf->data = cf;
1176 else cf_write->next = cf;
1177
1178 cf_write = cf;
1179 mf = mf_next;
1180 }
1181
1182 return outf;
1183 }
1184
1185
1186
1187 /* color_copy_glyph_range:
1188 * Colour font helper function. Copies (part of) a glyph range
1189 */
color_copy_glyph_range(FONT_COLOR_DATA * cf,int begin,int end)1190 static FONT_COLOR_DATA *color_copy_glyph_range(FONT_COLOR_DATA *cf, int begin, int end)
1191 {
1192 FONT_COLOR_DATA *newcf;
1193 BITMAP **gl;
1194 BITMAP *g;
1195 int num, c;
1196
1197 if (begin<cf->begin || end>cf->end)
1198 return NULL;
1199
1200 newcf = _AL_MALLOC(sizeof *newcf);
1201
1202 if (!newcf)
1203 return NULL;
1204
1205 newcf->begin = begin;
1206 newcf->end = end;
1207 newcf->next = NULL;
1208 num = end - begin;
1209
1210 gl = newcf->bitmaps = _AL_MALLOC(num * sizeof *gl);
1211 for (c=0; c<num; c++) {
1212 g = cf->bitmaps[begin - cf->begin + c];
1213 gl[c] = create_bitmap_ex(bitmap_color_depth(g), g->w, g->h);
1214 blit(g, gl[c], 0, 0, 0, 0, g->w, g->h);
1215 }
1216
1217 return newcf;
1218 }
1219
1220
1221
1222 /* color_extract_font_range:
1223 * (color vtable entry)
1224 * Extract a range of characters from a color font
1225 */
color_extract_font_range(FONT * f,int begin,int end)1226 static FONT *color_extract_font_range(FONT *f, int begin, int end)
1227 {
1228 FONT *fontout = NULL;
1229 FONT_COLOR_DATA *cf, *cfin;
1230 int first, last;
1231
1232 if (!f)
1233 return NULL;
1234
1235 /* Special case: copy entire font */
1236 if (begin==-1 && end==-1) {
1237 }
1238 /* Copy from the beginning */
1239 else if (begin == -1 && end > color_get_font_range_begin(f, -1)) {
1240 }
1241 /* Copy to the end */
1242 else if (end == -1 && begin <= color_get_font_range_end(f, -1)) {
1243 }
1244 /* begin cannot be bigger than end */
1245 else if (begin <= end && begin != -1 && end != -1) {
1246 }
1247 else {
1248 return NULL;
1249 }
1250
1251 /* Get output font */
1252 fontout = _AL_MALLOC(sizeof *fontout);
1253
1254 fontout->height = f->height;
1255 fontout->vtable = f->vtable;
1256 fontout->data = NULL;
1257
1258 /* Get real character ranges */
1259 first = MAX(begin, color_get_font_range_begin(f, -1));
1260 last = (end>-1) ? MIN(end, color_get_font_range_end(f, -1)) : color_get_font_range_end(f, -1);
1261 last++;
1262
1263 cf = NULL;
1264 cfin = f->data;
1265 while (cfin) {
1266 /* Find the range that is covered by the requested range. */
1267 /* Check if the requested and processed ranges at least overlap */
1268 if (((first >= cfin->begin && first < cfin->end) || (last <= cfin->end && last > cfin->begin))
1269 /* Check if the requested range wraps processed ranges */
1270 || (first < cfin->begin && last > cfin->end)) {
1271 int local_begin, local_end;
1272
1273 local_begin = MAX(cfin->begin, first);
1274 local_end = MIN(cfin->end, last);
1275
1276 if (cf) {
1277 cf->next = color_copy_glyph_range(cfin, local_begin, local_end);
1278 cf = cf->next;
1279 }
1280 else {
1281 cf = color_copy_glyph_range(cfin, local_begin, local_end);
1282 fontout->data = cf;
1283 }
1284 }
1285 cfin = cfin->next;
1286 }
1287
1288 return fontout;
1289 }
1290
1291
1292
1293 /* color_merge_fonts:
1294 * (color vtable entry)
1295 * Merges font2 with font1 and returns a new font
1296 */
color_merge_fonts(FONT * font1,FONT * font2)1297 static FONT *color_merge_fonts(FONT *font1, FONT *font2)
1298 {
1299 FONT *fontout = NULL, *font2_upgr = NULL;
1300 FONT_COLOR_DATA *cf, *cf1, *cf2;
1301
1302 if (!font1 || !font2)
1303 return NULL;
1304
1305 /* Promote font 2 to colour if it is a monochrome font */
1306 if (!is_color_font(font1))
1307 return NULL;
1308
1309 if (is_mono_font(font2)) {
1310 font2_upgr = upgrade_to_color(font2);
1311 /* Couldn't update font */
1312 if (!font2_upgr)
1313 return NULL;
1314 }
1315 else
1316 font2_upgr = font2;
1317
1318 if (!is_color_font(font2_upgr))
1319 return NULL;
1320
1321 /* Get output font */
1322 fontout = _AL_MALLOC(sizeof *fontout);
1323 fontout->height = MAX(font1->height, font2->height);
1324 fontout->vtable = font1->vtable;
1325 cf = fontout->data = NULL;
1326
1327 cf1 = font1->data;
1328 cf2 = font2_upgr->data;
1329 while (cf1 || cf2) {
1330 if (cf1 && (!cf2 || (cf1->begin < cf2->begin))) {
1331 if (cf) {
1332 cf->next = color_copy_glyph_range(cf1, cf1->begin, cf1->end);
1333 cf = cf->next;
1334 }
1335 else {
1336 cf = color_copy_glyph_range(cf1, cf1->begin, cf1->end);
1337 fontout->data = cf;
1338 }
1339 cf1 = cf1->next;
1340 }
1341 else {
1342 if (cf) {
1343 cf->next = color_copy_glyph_range(cf2, cf2->begin, cf2->end);
1344 cf = cf->next;
1345 }
1346 else {
1347 cf = color_copy_glyph_range(cf2, cf2->begin, cf2->end);
1348 fontout->data = cf;
1349 }
1350 cf2 = cf2->next;
1351 }
1352 }
1353
1354 if (font2_upgr != font2)
1355 destroy_font(font2_upgr);
1356
1357 return fontout;
1358 }
1359
1360
1361
1362 /* color_transpose_font:
1363 * (color vtable entry)
1364 * Transpose all glyphs in a font
1365 */
color_transpose_font(FONT * f,int drange)1366 static int color_transpose_font(FONT* f, int drange)
1367 {
1368 FONT_COLOR_DATA* cf = 0;
1369
1370 if (!f)
1371 return -1;
1372
1373 cf = (FONT_COLOR_DATA*)(f->data);
1374
1375 while(cf) {
1376 FONT_COLOR_DATA* next = cf->next;
1377
1378 cf->begin += drange;
1379 cf->end += drange;
1380 cf = next;
1381 }
1382
1383 return 0;
1384 }
1385
1386
1387
1388 /********
1389 * vtable declarations
1390 ********/
1391
1392 FONT_VTABLE _font_vtable_mono = {
1393 font_height,
1394 mono_char_length,
1395 length,
1396 mono_render_char,
1397 mono_render,
1398 mono_destroy,
1399
1400 mono_get_font_ranges,
1401 mono_get_font_range_begin,
1402 mono_get_font_range_end,
1403 mono_extract_font_range,
1404 mono_merge_fonts,
1405 mono_transpose_font
1406 };
1407
1408 FONT_VTABLE* font_vtable_mono = &_font_vtable_mono;
1409
1410 FONT_VTABLE _font_vtable_color = {
1411 font_height,
1412 color_char_length,
1413 length,
1414 color_render_char,
1415 color_render,
1416 color_destroy,
1417
1418 color_get_font_ranges,
1419 color_get_font_range_begin,
1420 color_get_font_range_end,
1421 color_extract_font_range,
1422 color_merge_fonts,
1423 color_transpose_font
1424 };
1425
1426 FONT_VTABLE* font_vtable_color = &_font_vtable_color;
1427
1428 FONT_VTABLE _font_vtable_trans = {
1429 font_height,
1430 color_char_length,
1431 length,
1432 trans_render_char,
1433 color_render,
1434 color_destroy,
1435
1436 color_get_font_ranges,
1437 color_get_font_range_begin,
1438 color_get_font_range_end,
1439 color_extract_font_range,
1440 color_merge_fonts,
1441 color_transpose_font
1442 };
1443
1444 FONT_VTABLE* font_vtable_trans = &_font_vtable_trans;
1445
1446
1447
1448 /* font_has_alpha:
1449 * Returns TRUE if a color font has an alpha channel.
1450 */
font_has_alpha(FONT * fnt)1451 int font_has_alpha(FONT *fnt)
1452 {
1453 FONT_COLOR_DATA *data;
1454 int ch;
1455
1456 ASSERT(fnt);
1457
1458 if (!is_color_font(fnt))
1459 return FALSE;
1460
1461 data = (FONT_COLOR_DATA *)(fnt->data);
1462
1463 while (data) {
1464 for (ch = data->begin; ch != data->end; ++ch)
1465 if (_bitmap_has_alpha(data->bitmaps[ch - data->begin]))
1466 return TRUE;
1467 data = data->next;
1468 }
1469
1470 return FALSE;
1471 }
1472
1473
1474
1475 /* make_trans_font:
1476 * Modifes a font so glyphs are drawn with draw_trans_sprite.
1477 */
make_trans_font(FONT * f)1478 void make_trans_font(FONT *f)
1479 {
1480 ASSERT(f);
1481 ASSERT(f->vtable == font_vtable_color);
1482
1483 f->vtable = font_vtable_trans;
1484 }
1485
1486
1487
1488 /* is_trans_font:
1489 * Returns non-zero if the font passed is a bitmapped colour font using
1490 * draw_trans_sprite to render glyphs.
1491 */
is_trans_font(FONT * f)1492 int is_trans_font(FONT *f)
1493 {
1494 ASSERT(f);
1495
1496 return (f->vtable == font_vtable_trans);
1497 }
1498
1499
1500
1501 /* is_color_font:
1502 * returns non-zero if the font passed is a bitmapped colour font
1503 */
is_color_font(FONT * f)1504 int is_color_font(FONT *f)
1505 {
1506 ASSERT(f);
1507
1508 return (f->vtable == font_vtable_color || f->vtable == font_vtable_trans);
1509 }
1510
1511
1512
1513 /* is_mono_font:
1514 * returns non-zero if the font passed is a monochrome font
1515 */
is_mono_font(FONT * f)1516 int is_mono_font(FONT *f)
1517 {
1518 ASSERT(f);
1519
1520 return f->vtable == font_vtable_mono;
1521 }
1522
1523
1524
1525 /* is_compatibe_font:
1526 * returns non-zero if the two fonts are of similar type
1527 */
is_compatible_font(FONT * f1,FONT * f2)1528 int is_compatible_font(FONT *f1, FONT *f2)
1529 {
1530 ASSERT(f1);
1531 ASSERT(f2);
1532 return f1->vtable == f2->vtable;
1533 }
1534
1535
1536
1537 /* extract_font_range:
1538 * Extracts a character range from a font f, and returns a new font containing
1539 * only the extracted characters.
1540 * Returns NULL if the character range could not be extracted.
1541 */
extract_font_range(FONT * f,int begin,int end)1542 FONT *extract_font_range(FONT *f, int begin, int end)
1543 {
1544 if (f->vtable->extract_font_range)
1545 return f->vtable->extract_font_range(f, begin, end);
1546 return NULL;
1547 }
1548
1549
1550
1551 /* merge_fonts:
1552 * Merges two fonts. May convert the two fonts to compatible types before
1553 * merging, in which case converting the type of f2 to f1 is tried first.
1554 */
merge_fonts(FONT * f1,FONT * f2)1555 FONT *merge_fonts(FONT *f1, FONT *f2)
1556 {
1557 FONT *f = NULL;
1558
1559 if (f1->vtable->merge_fonts)
1560 f = f1->vtable->merge_fonts(f1, f2);
1561
1562 if (!f && f2->vtable->merge_fonts)
1563 f = f2->vtable->merge_fonts(f2, f1);
1564
1565 return f;
1566 }
1567
1568
1569
1570 /* get_font_ranges:
1571 * Returns the number of character ranges in a font, or -1 if that information
1572 * is not available.
1573 */
get_font_ranges(FONT * f)1574 int get_font_ranges(FONT *f)
1575 {
1576 if (f->vtable->get_font_ranges)
1577 return f->vtable->get_font_ranges(f);
1578
1579 return -1;
1580 }
1581
1582
1583
1584 /* get_font_range_begin:
1585 * Returns the starting character for the font in question, or -1 if that
1586 * information is not available.
1587 */
get_font_range_begin(FONT * f,int range)1588 int get_font_range_begin(FONT *f, int range)
1589 {
1590 if (f->vtable->get_font_range_begin)
1591 return f->vtable->get_font_range_begin(f, range);
1592
1593 return -1;
1594 }
1595
1596
1597
1598 /* get_font_range_end:
1599 * Returns the last character for the font in question, or -1 if that
1600 * information is not available.
1601 */
get_font_range_end(FONT * f,int range)1602 int get_font_range_end(FONT *f, int range)
1603 {
1604 if (f->vtable->get_font_range_end)
1605 return f->vtable->get_font_range_end(f, range);
1606
1607 return -1;
1608 }
1609
1610
1611
1612
1613 /* transpose_font:
1614 * Transposes all the glyphs in a font over a range drange. Returns 0 on
1615 * success, or -1 on failure.
1616 */
transpose_font(FONT * f,int drange)1617 int transpose_font(FONT *f, int drange)
1618 {
1619 if (f->vtable->transpose_font)
1620 return f->vtable->transpose_font(f, drange);
1621
1622 return -1;
1623 }
1624
1625
1626
1627 /********
1628 * Declaration of `_default_font' and `font'
1629 ********/
1630
1631 static FONT_MONO_DATA euro_monofont = {
1632 0x20AC, 0x20AD, /* begin, end characters */
1633 euro_data, /* the data set */
1634 0 /* next */
1635 };
1636
1637 static FONT_MONO_DATA extended_a_monofont = {
1638 0x100, 0x180, /* begin, end characters */
1639 extended_a_data, /* the data set */
1640 &euro_monofont /* next */
1641 };
1642
1643 static FONT_MONO_DATA latin1_monofont = {
1644 0x0A1, 0x100, /* begin, end characters */
1645 latin1_data, /* the data set */
1646 &extended_a_monofont /* next */
1647 };
1648
1649 static FONT_MONO_DATA ascii_monofont = {
1650 0x20, 0x80, /* begin, end characters */
1651 ascii_data, /* the data set */
1652 &latin1_monofont /* next */
1653 };
1654
1655 static FONT default_font = {
1656 &ascii_monofont, /* first lot of data */
1657 8, /* height */
1658 &_font_vtable_mono /* vtable */
1659 };
1660
1661 FONT* font = &default_font;
1662
1663
1664