1 /* mswindows-specific Lisp objects.
2 Copyright (C) 1993, 1994 Free Software Foundation, Inc.
3 Copyright (C) 1995 Board of Trustees, University of Illinois.
4 Copyright (C) 1995 Tinker Systems.
5 Copyright (C) 1995, 1996 Ben Wing.
6 Copyright (C) 1995 Sun Microsystems, Inc.
7 Copyright (C) 1997 Jonathan Harris.
9 This file is part of XEmacs.
11 XEmacs is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2, or (at your option) any
16 XEmacs is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with XEmacs; see the file COPYING. If not, write to
23 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA. */
26 /* Synched up with: Not in FSF. */
30 Jamie Zawinski, Chuck Thompson, Ben Wing
31 Rewritten for mswindows by Jonathan Harris, November 1997 for 21.0.
35 /* TODO: palette handling */
41 #include "console-msw.h"
42 #include "objects-msw.h"
45 #include "character.h"
52 typedef struct colormap_t
58 /* Colors from X11R6 "XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp" */
59 /* MSWindows tends to round up the numbers in it's palette, ie where X uses
60 * 127, MSWindows uses 128. Colors commented as "Adjusted" are tweaked to
61 * match the Windows standard palette to increase the likelihood of
62 * mswindows_color_to_string() finding a named match.
64 static const colormap_t mswindows_X_color_map[] =
66 {"white" , PALETTERGB (255, 255, 255) },
67 {"black" , PALETTERGB (0, 0, 0) },
68 {"snow" , PALETTERGB (255, 250, 250) },
69 {"GhostWhite" , PALETTERGB (248, 248, 255) },
70 {"WhiteSmoke" , PALETTERGB (245, 245, 245) },
71 {"gainsboro" , PALETTERGB (220, 220, 220) },
72 {"FloralWhite" , PALETTERGB (255, 250, 240) },
73 {"OldLace" , PALETTERGB (253, 245, 230) },
74 {"linen" , PALETTERGB (250, 240, 230) },
75 {"AntiqueWhite" , PALETTERGB (250, 235, 215) },
76 {"PapayaWhip" , PALETTERGB (255, 239, 213) },
77 {"BlanchedAlmond" , PALETTERGB (255, 235, 205) },
78 {"bisque" , PALETTERGB (255, 228, 196) },
79 {"PeachPuff" , PALETTERGB (255, 218, 185) },
80 {"NavajoWhite" , PALETTERGB (255, 222, 173) },
81 {"moccasin" , PALETTERGB (255, 228, 181) },
82 {"cornsilk" , PALETTERGB (255, 248, 220) },
83 {"ivory" , PALETTERGB (255, 255, 240) },
84 {"LemonChiffon" , PALETTERGB (255, 250, 205) },
85 {"seashell" , PALETTERGB (255, 245, 238) },
86 {"honeydew" , PALETTERGB (240, 255, 240) },
87 {"MintCream" , PALETTERGB (245, 255, 250) },
88 {"azure" , PALETTERGB (240, 255, 255) },
89 {"AliceBlue" , PALETTERGB (240, 248, 255) },
90 {"lavender" , PALETTERGB (230, 230, 250) },
91 {"LavenderBlush" , PALETTERGB (255, 240, 245) },
92 {"MistyRose" , PALETTERGB (255, 228, 225) },
93 {"DarkSlateGray" , PALETTERGB (47, 79, 79) },
94 {"DarkSlateGrey" , PALETTERGB (47, 79, 79) },
95 {"DimGray" , PALETTERGB (105, 105, 105) },
96 {"DimGrey" , PALETTERGB (105, 105, 105) },
97 {"SlateGray" , PALETTERGB (112, 128, 144) },
98 {"SlateGrey" , PALETTERGB (112, 128, 144) },
99 {"LightSlateGray" , PALETTERGB (119, 136, 153) },
100 {"LightSlateGrey" , PALETTERGB (119, 136, 153) },
101 {"gray" , PALETTERGB (190, 190, 190) },
102 {"grey" , PALETTERGB (190, 190, 190) },
103 {"LightGrey" , PALETTERGB (211, 211, 211) },
104 {"LightGray" , PALETTERGB (211, 211, 211) },
105 {"MidnightBlue" , PALETTERGB (25, 25, 112) },
106 {"navy" , PALETTERGB (0, 0, 128) },
107 {"NavyBlue" , PALETTERGB (0, 0, 128) },
108 {"CornflowerBlue" , PALETTERGB (100, 149, 237) },
109 {"DarkSlateBlue" , PALETTERGB (72, 61, 139) },
110 {"SlateBlue" , PALETTERGB (106, 90, 205) },
111 {"MediumSlateBlue" , PALETTERGB (123, 104, 238) },
112 {"LightSlateBlue" , PALETTERGB (132, 112, 255) },
113 {"MediumBlue" , PALETTERGB (0, 0, 205) },
114 {"RoyalBlue" , PALETTERGB (65, 105, 225) },
115 {"blue" , PALETTERGB (0, 0, 255) },
116 {"DodgerBlue" , PALETTERGB (30, 144, 255) },
117 {"DeepSkyBlue" , PALETTERGB (0, 191, 255) },
118 {"SkyBlue" , PALETTERGB (135, 206, 235) },
119 {"LightSkyBlue" , PALETTERGB (135, 206, 250) },
120 {"SteelBlue" , PALETTERGB (70, 130, 180) },
121 {"LightSteelBlue" , PALETTERGB (176, 196, 222) },
122 {"LightBlue" , PALETTERGB (173, 216, 230) },
123 {"PowderBlue" , PALETTERGB (176, 224, 230) },
124 {"PaleTurquoise" , PALETTERGB (175, 238, 238) },
125 {"DarkTurquoise" , PALETTERGB (0, 206, 209) },
126 {"MediumTurquoise" , PALETTERGB (72, 209, 204) },
127 {"turquoise" , PALETTERGB (64, 224, 208) },
128 {"cyan" , PALETTERGB (0, 255, 255) },
129 {"LightCyan" , PALETTERGB (224, 255, 255) },
130 {"CadetBlue" , PALETTERGB (95, 158, 160) },
131 {"MediumAquamarine" , PALETTERGB (102, 205, 170) },
132 {"aquamarine" , PALETTERGB (127, 255, 212) },
133 {"DarkGreen" , PALETTERGB (0, 128, 0) }, /* Adjusted */
134 {"DarkOliveGreen" , PALETTERGB (85, 107, 47) },
135 {"DarkSeaGreen" , PALETTERGB (143, 188, 143) },
136 {"SeaGreen" , PALETTERGB (46, 139, 87) },
137 {"MediumSeaGreen" , PALETTERGB (60, 179, 113) },
138 {"LightSeaGreen" , PALETTERGB (32, 178, 170) },
139 {"PaleGreen" , PALETTERGB (152, 251, 152) },
140 {"SpringGreen" , PALETTERGB (0, 255, 127) },
141 {"LawnGreen" , PALETTERGB (124, 252, 0) },
142 {"green" , PALETTERGB (0, 255, 0) },
143 {"chartreuse" , PALETTERGB (127, 255, 0) },
144 {"MediumSpringGreen" , PALETTERGB (0, 250, 154) },
145 {"GreenYellow" , PALETTERGB (173, 255, 47) },
146 {"LimeGreen" , PALETTERGB (50, 205, 50) },
147 {"YellowGreen" , PALETTERGB (154, 205, 50) },
148 {"ForestGreen" , PALETTERGB (34, 139, 34) },
149 {"OliveDrab" , PALETTERGB (107, 142, 35) },
150 {"DarkKhaki" , PALETTERGB (189, 183, 107) },
151 {"khaki" , PALETTERGB (240, 230, 140) },
152 {"PaleGoldenrod" , PALETTERGB (238, 232, 170) },
153 {"LightGoldenrodYellow", PALETTERGB (250, 250, 210) },
154 {"LightYellow" , PALETTERGB (255, 255, 224) },
155 {"LightYellow" , PALETTERGB (255, 255, 225) }, /* Adjusted */
156 {"yellow" , PALETTERGB (255, 255, 0) },
157 {"gold" , PALETTERGB (255, 215, 0) },
158 {"LightGoldenrod" , PALETTERGB (238, 221, 130) },
159 {"goldenrod" , PALETTERGB (218, 165, 32) },
160 {"DarkGoldenrod" , PALETTERGB (184, 134, 11) },
161 {"RosyBrown" , PALETTERGB (188, 143, 143) },
162 {"IndianRed" , PALETTERGB (205, 92, 92) },
163 {"SaddleBrown" , PALETTERGB (139, 69, 19) },
164 {"sienna" , PALETTERGB (160, 82, 45) },
165 {"peru" , PALETTERGB (205, 133, 63) },
166 {"burlywood" , PALETTERGB (222, 184, 135) },
167 {"beige" , PALETTERGB (245, 245, 220) },
168 {"wheat" , PALETTERGB (245, 222, 179) },
169 {"SandyBrown" , PALETTERGB (244, 164, 96) },
170 {"tan" , PALETTERGB (210, 180, 140) },
171 {"chocolate" , PALETTERGB (210, 105, 30) },
172 {"firebrick" , PALETTERGB (178, 34, 34) },
173 {"brown" , PALETTERGB (165, 42, 42) },
174 {"DarkSalmon" , PALETTERGB (233, 150, 122) },
175 {"salmon" , PALETTERGB (250, 128, 114) },
176 {"LightSalmon" , PALETTERGB (255, 160, 122) },
177 {"orange" , PALETTERGB (255, 165, 0) },
178 {"DarkOrange" , PALETTERGB (255, 140, 0) },
179 {"coral" , PALETTERGB (255, 127, 80) },
180 {"LightCoral" , PALETTERGB (240, 128, 128) },
181 {"tomato" , PALETTERGB (255, 99, 71) },
182 {"OrangeRed" , PALETTERGB (255, 69, 0) },
183 {"red" , PALETTERGB (255, 0, 0) },
184 {"HotPink" , PALETTERGB (255, 105, 180) },
185 {"DeepPink" , PALETTERGB (255, 20, 147) },
186 {"pink" , PALETTERGB (255, 192, 203) },
187 {"LightPink" , PALETTERGB (255, 182, 193) },
188 {"PaleVioletRed" , PALETTERGB (219, 112, 147) },
189 {"maroon" , PALETTERGB (176, 48, 96) },
190 {"MediumVioletRed" , PALETTERGB (199, 21, 133) },
191 {"VioletRed" , PALETTERGB (208, 32, 144) },
192 {"magenta" , PALETTERGB (255, 0, 255) },
193 {"violet" , PALETTERGB (238, 130, 238) },
194 {"plum" , PALETTERGB (221, 160, 221) },
195 {"orchid" , PALETTERGB (218, 112, 214) },
196 {"MediumOrchid" , PALETTERGB (186, 85, 211) },
197 {"DarkOrchid" , PALETTERGB (153, 50, 204) },
198 {"DarkViolet" , PALETTERGB (148, 0, 211) },
199 {"BlueViolet" , PALETTERGB (138, 43, 226) },
200 {"purple" , PALETTERGB (160, 32, 240) },
201 {"MediumPurple" , PALETTERGB (147, 112, 219) },
202 {"thistle" , PALETTERGB (216, 191, 216) },
203 {"snow1" , PALETTERGB (255, 250, 250) },
204 {"snow2" , PALETTERGB (238, 233, 233) },
205 {"snow3" , PALETTERGB (205, 201, 201) },
206 {"snow4" , PALETTERGB (139, 137, 137) },
207 {"seashell1" , PALETTERGB (255, 245, 238) },
208 {"seashell2" , PALETTERGB (238, 229, 222) },
209 {"seashell3" , PALETTERGB (205, 197, 191) },
210 {"seashell4" , PALETTERGB (139, 134, 130) },
211 {"AntiqueWhite1" , PALETTERGB (255, 239, 219) },
212 {"AntiqueWhite2" , PALETTERGB (238, 223, 204) },
213 {"AntiqueWhite3" , PALETTERGB (205, 192, 176) },
214 {"AntiqueWhite4" , PALETTERGB (139, 131, 120) },
215 {"bisque1" , PALETTERGB (255, 228, 196) },
216 {"bisque2" , PALETTERGB (238, 213, 183) },
217 {"bisque3" , PALETTERGB (205, 183, 158) },
218 {"bisque4" , PALETTERGB (139, 125, 107) },
219 {"PeachPuff1" , PALETTERGB (255, 218, 185) },
220 {"PeachPuff2" , PALETTERGB (238, 203, 173) },
221 {"PeachPuff3" , PALETTERGB (205, 175, 149) },
222 {"PeachPuff4" , PALETTERGB (139, 119, 101) },
223 {"NavajoWhite1" , PALETTERGB (255, 222, 173) },
224 {"NavajoWhite2" , PALETTERGB (238, 207, 161) },
225 {"NavajoWhite3" , PALETTERGB (205, 179, 139) },
226 {"NavajoWhite4" , PALETTERGB (139, 121, 94) },
227 {"LemonChiffon1" , PALETTERGB (255, 250, 205) },
228 {"LemonChiffon2" , PALETTERGB (238, 233, 191) },
229 {"LemonChiffon3" , PALETTERGB (205, 201, 165) },
230 {"LemonChiffon4" , PALETTERGB (139, 137, 112) },
231 {"cornsilk1" , PALETTERGB (255, 248, 220) },
232 {"cornsilk2" , PALETTERGB (238, 232, 205) },
233 {"cornsilk3" , PALETTERGB (205, 200, 177) },
234 {"cornsilk4" , PALETTERGB (139, 136, 120) },
235 {"ivory1" , PALETTERGB (255, 255, 240) },
236 {"ivory2" , PALETTERGB (240, 240, 208) }, /* Adjusted */
237 {"ivory3" , PALETTERGB (205, 205, 193) },
238 {"ivory4" , PALETTERGB (139, 139, 131) },
239 {"honeydew1" , PALETTERGB (240, 255, 240) },
240 {"honeydew2" , PALETTERGB (224, 238, 224) },
241 {"honeydew3" , PALETTERGB (193, 205, 193) },
242 {"honeydew4" , PALETTERGB (131, 139, 131) },
243 {"LavenderBlush1" , PALETTERGB (255, 240, 245) },
244 {"LavenderBlush2" , PALETTERGB (238, 224, 229) },
245 {"LavenderBlush3" , PALETTERGB (205, 193, 197) },
246 {"LavenderBlush4" , PALETTERGB (139, 131, 134) },
247 {"MistyRose1" , PALETTERGB (255, 228, 225) },
248 {"MistyRose2" , PALETTERGB (238, 213, 210) },
249 {"MistyRose3" , PALETTERGB (205, 183, 181) },
250 {"MistyRose4" , PALETTERGB (139, 125, 123) },
251 {"azure1" , PALETTERGB (240, 255, 255) },
252 {"azure2" , PALETTERGB (224, 238, 238) },
253 {"azure3" , PALETTERGB (193, 205, 205) },
254 {"azure4" , PALETTERGB (131, 139, 139) },
255 {"SlateBlue1" , PALETTERGB (131, 111, 255) },
256 {"SlateBlue2" , PALETTERGB (122, 103, 238) },
257 {"SlateBlue3" , PALETTERGB (105, 89, 205) },
258 {"SlateBlue4" , PALETTERGB (71, 60, 139) },
259 {"RoyalBlue1" , PALETTERGB (72, 118, 255) },
260 {"RoyalBlue2" , PALETTERGB (67, 110, 238) },
261 {"RoyalBlue3" , PALETTERGB (58, 95, 205) },
262 {"RoyalBlue4" , PALETTERGB (39, 64, 139) },
263 {"blue1" , PALETTERGB (0, 0, 255) },
264 {"blue2" , PALETTERGB (0, 0, 238) },
265 {"blue3" , PALETTERGB (0, 0, 205) },
266 {"blue4" , PALETTERGB (0, 0, 139) },
267 {"DodgerBlue1" , PALETTERGB (30, 144, 255) },
268 {"DodgerBlue2" , PALETTERGB (28, 134, 238) },
269 {"DodgerBlue3" , PALETTERGB (24, 116, 205) },
270 {"DodgerBlue4" , PALETTERGB (16, 78, 139) },
271 {"SteelBlue1" , PALETTERGB (99, 184, 255) },
272 {"SteelBlue2" , PALETTERGB (92, 172, 238) },
273 {"SteelBlue3" , PALETTERGB (79, 148, 205) },
274 {"SteelBlue4" , PALETTERGB (54, 100, 139) },
275 {"DeepSkyBlue1" , PALETTERGB (0, 191, 255) },
276 {"DeepSkyBlue2" , PALETTERGB (0, 178, 238) },
277 {"DeepSkyBlue3" , PALETTERGB (0, 154, 205) },
278 {"DeepSkyBlue4" , PALETTERGB (0, 104, 139) },
279 {"SkyBlue1" , PALETTERGB (135, 206, 255) },
280 {"SkyBlue2" , PALETTERGB (126, 192, 238) },
281 {"SkyBlue3" , PALETTERGB (108, 166, 205) },
282 {"SkyBlue4" , PALETTERGB (74, 112, 139) },
283 {"LightSkyBlue1" , PALETTERGB (176, 226, 255) },
284 {"LightSkyBlue2" , PALETTERGB (164, 211, 238) },
285 {"LightSkyBlue3" , PALETTERGB (141, 182, 205) },
286 {"LightSkyBlue4" , PALETTERGB (96, 123, 139) },
287 {"SlateGray1" , PALETTERGB (198, 226, 255) },
288 {"SlateGray2" , PALETTERGB (185, 211, 238) },
289 {"SlateGray3" , PALETTERGB (159, 182, 205) },
290 {"SlateGray4" , PALETTERGB (108, 123, 139) },
291 {"LightSteelBlue1" , PALETTERGB (202, 225, 255) },
292 {"LightSteelBlue2" , PALETTERGB (188, 210, 238) },
293 {"LightSteelBlue3" , PALETTERGB (162, 181, 205) },
294 {"LightSteelBlue4" , PALETTERGB (110, 123, 139) },
295 {"LightBlue1" , PALETTERGB (191, 239, 255) },
296 {"LightBlue2" , PALETTERGB (178, 223, 238) },
297 {"LightBlue3" , PALETTERGB (154, 192, 205) },
298 {"LightBlue4" , PALETTERGB (104, 131, 139) },
299 {"LightCyan1" , PALETTERGB (224, 255, 255) },
300 {"LightCyan2" , PALETTERGB (209, 238, 238) },
301 {"LightCyan3" , PALETTERGB (180, 205, 205) },
302 {"LightCyan4" , PALETTERGB (122, 139, 139) },
303 {"PaleTurquoise1" , PALETTERGB (187, 255, 255) },
304 {"PaleTurquoise2" , PALETTERGB (174, 238, 238) },
305 {"PaleTurquoise3" , PALETTERGB (150, 205, 205) },
306 {"PaleTurquoise4" , PALETTERGB (102, 139, 139) },
307 {"CadetBlue1" , PALETTERGB (152, 245, 255) },
308 {"CadetBlue2" , PALETTERGB (144, 220, 240) }, /* Adjusted */
309 {"CadetBlue3" , PALETTERGB (122, 197, 205) },
310 {"CadetBlue4" , PALETTERGB (83, 134, 139) },
311 {"turquoise1" , PALETTERGB (0, 245, 255) },
312 {"turquoise2" , PALETTERGB (0, 229, 238) },
313 {"turquoise3" , PALETTERGB (0, 197, 205) },
314 {"turquoise4" , PALETTERGB (0, 134, 139) },
315 {"cyan1" , PALETTERGB (0, 255, 255) },
316 {"cyan2" , PALETTERGB (0, 238, 238) },
317 {"cyan3" , PALETTERGB (0, 205, 205) },
318 {"cyan4" , PALETTERGB (0, 139, 139) },
319 {"DarkSlateGray1" , PALETTERGB (151, 255, 255) },
320 {"DarkSlateGray2" , PALETTERGB (141, 238, 238) },
321 {"DarkSlateGray3" , PALETTERGB (121, 205, 205) },
322 {"DarkSlateGray4" , PALETTERGB (82, 139, 139) },
323 {"aquamarine1" , PALETTERGB (127, 255, 212) },
324 {"aquamarine2" , PALETTERGB (118, 238, 198) },
325 {"aquamarine3" , PALETTERGB (102, 205, 170) },
326 {"aquamarine4" , PALETTERGB (69, 139, 116) },
327 {"DarkSeaGreen1" , PALETTERGB (193, 255, 193) },
328 {"DarkSeaGreen2" , PALETTERGB (180, 238, 180) },
329 {"DarkSeaGreen3" , PALETTERGB (155, 205, 155) },
330 {"DarkSeaGreen4" , PALETTERGB (105, 139, 105) },
331 {"SeaGreen1" , PALETTERGB (84, 255, 159) },
332 {"SeaGreen2" , PALETTERGB (78, 238, 148) },
333 {"SeaGreen3" , PALETTERGB (67, 205, 128) },
334 {"SeaGreen4" , PALETTERGB (46, 139, 87) },
335 {"PaleGreen1" , PALETTERGB (154, 255, 154) },
336 {"PaleGreen2" , PALETTERGB (144, 238, 144) },
337 {"PaleGreen3" , PALETTERGB (124, 205, 124) },
338 {"PaleGreen4" , PALETTERGB (84, 139, 84) },
339 {"SpringGreen1" , PALETTERGB (0, 255, 127) },
340 {"SpringGreen2" , PALETTERGB (0, 238, 118) },
341 {"SpringGreen3" , PALETTERGB (0, 205, 102) },
342 {"SpringGreen4" , PALETTERGB (0, 139, 69) },
343 {"green1" , PALETTERGB (0, 255, 0) },
344 {"green2" , PALETTERGB (0, 238, 0) },
345 {"green3" , PALETTERGB (0, 205, 0) },
346 {"green4" , PALETTERGB (0, 139, 0) },
347 {"chartreuse1" , PALETTERGB (127, 255, 0) },
348 {"chartreuse2" , PALETTERGB (118, 238, 0) },
349 {"chartreuse3" , PALETTERGB (102, 205, 0) },
350 {"chartreuse4" , PALETTERGB (69, 139, 0) },
351 {"OliveDrab1" , PALETTERGB (192, 255, 62) },
352 {"OliveDrab2" , PALETTERGB (179, 238, 58) },
353 {"OliveDrab3" , PALETTERGB (154, 205, 50) },
354 {"OliveDrab4" , PALETTERGB (105, 139, 34) },
355 {"DarkOliveGreen1" , PALETTERGB (202, 255, 112) },
356 {"DarkOliveGreen2" , PALETTERGB (188, 238, 104) },
357 {"DarkOliveGreen3" , PALETTERGB (162, 205, 90) },
358 {"DarkOliveGreen4" , PALETTERGB (110, 139, 61) },
359 {"khaki1" , PALETTERGB (255, 246, 143) },
360 {"khaki2" , PALETTERGB (238, 230, 133) },
361 {"khaki3" , PALETTERGB (205, 198, 115) },
362 {"khaki4" , PALETTERGB (139, 134, 78) },
363 {"LightGoldenrod1" , PALETTERGB (255, 236, 139) },
364 {"LightGoldenrod2" , PALETTERGB (238, 220, 130) },
365 {"LightGoldenrod3" , PALETTERGB (205, 190, 112) },
366 {"LightGoldenrod4" , PALETTERGB (139, 129, 76) },
367 {"LightYellow1" , PALETTERGB (255, 255, 224) },
368 {"LightYellow2" , PALETTERGB (238, 238, 209) },
369 {"LightYellow3" , PALETTERGB (205, 205, 180) },
370 {"LightYellow4" , PALETTERGB (139, 139, 122) },
371 {"yellow1" , PALETTERGB (255, 255, 0) },
372 {"yellow2" , PALETTERGB (238, 238, 0) },
373 {"yellow3" , PALETTERGB (205, 205, 0) },
374 {"yellow4" , PALETTERGB (139, 139, 0) },
375 {"gold1" , PALETTERGB (255, 215, 0) },
376 {"gold2" , PALETTERGB (238, 201, 0) },
377 {"gold3" , PALETTERGB (205, 173, 0) },
378 {"gold4" , PALETTERGB (139, 117, 0) },
379 {"goldenrod1" , PALETTERGB (255, 193, 37) },
380 {"goldenrod2" , PALETTERGB (238, 180, 34) },
381 {"goldenrod3" , PALETTERGB (205, 155, 29) },
382 {"goldenrod4" , PALETTERGB (139, 105, 20) },
383 {"DarkGoldenrod1" , PALETTERGB (255, 185, 15) },
384 {"DarkGoldenrod2" , PALETTERGB (238, 173, 14) },
385 {"DarkGoldenrod3" , PALETTERGB (205, 149, 12) },
386 {"DarkGoldenrod4" , PALETTERGB (139, 101, 8) },
387 {"RosyBrown1" , PALETTERGB (255, 193, 193) },
388 {"RosyBrown2" , PALETTERGB (238, 180, 180) },
389 {"RosyBrown3" , PALETTERGB (205, 155, 155) },
390 {"RosyBrown4" , PALETTERGB (139, 105, 105) },
391 {"IndianRed1" , PALETTERGB (255, 106, 106) },
392 {"IndianRed2" , PALETTERGB (238, 99, 99) },
393 {"IndianRed3" , PALETTERGB (205, 85, 85) },
394 {"IndianRed4" , PALETTERGB (139, 58, 58) },
395 {"sienna1" , PALETTERGB (255, 130, 71) },
396 {"sienna2" , PALETTERGB (238, 121, 66) },
397 {"sienna3" , PALETTERGB (205, 104, 57) },
398 {"sienna4" , PALETTERGB (139, 71, 38) },
399 {"burlywood1" , PALETTERGB (255, 211, 155) },
400 {"burlywood2" , PALETTERGB (238, 197, 145) },
401 {"burlywood3" , PALETTERGB (205, 170, 125) },
402 {"burlywood4" , PALETTERGB (139, 115, 85) },
403 {"wheat1" , PALETTERGB (255, 231, 186) },
404 {"wheat2" , PALETTERGB (238, 216, 174) },
405 {"wheat3" , PALETTERGB (205, 186, 150) },
406 {"wheat4" , PALETTERGB (139, 126, 102) },
407 {"tan1" , PALETTERGB (255, 165, 79) },
408 {"tan2" , PALETTERGB (238, 154, 73) },
409 {"tan3" , PALETTERGB (205, 133, 63) },
410 {"tan4" , PALETTERGB (139, 90, 43) },
411 {"chocolate1" , PALETTERGB (255, 127, 36) },
412 {"chocolate2" , PALETTERGB (238, 118, 33) },
413 {"chocolate3" , PALETTERGB (205, 102, 29) },
414 {"chocolate4" , PALETTERGB (139, 69, 19) },
415 {"firebrick1" , PALETTERGB (255, 48, 48) },
416 {"firebrick2" , PALETTERGB (238, 44, 44) },
417 {"firebrick3" , PALETTERGB (205, 38, 38) },
418 {"firebrick4" , PALETTERGB (139, 26, 26) },
419 {"brown1" , PALETTERGB (255, 64, 64) },
420 {"brown2" , PALETTERGB (238, 59, 59) },
421 {"brown3" , PALETTERGB (205, 51, 51) },
422 {"brown4" , PALETTERGB (139, 35, 35) },
423 {"salmon1" , PALETTERGB (255, 140, 105) },
424 {"salmon2" , PALETTERGB (238, 130, 98) },
425 {"salmon3" , PALETTERGB (205, 112, 84) },
426 {"salmon4" , PALETTERGB (139, 76, 57) },
427 {"LightSalmon1" , PALETTERGB (255, 160, 122) },
428 {"LightSalmon2" , PALETTERGB (238, 149, 114) },
429 {"LightSalmon3" , PALETTERGB (205, 129, 98) },
430 {"LightSalmon4" , PALETTERGB (139, 87, 66) },
431 {"orange1" , PALETTERGB (255, 165, 0) },
432 {"orange2" , PALETTERGB (238, 154, 0) },
433 {"orange3" , PALETTERGB (205, 133, 0) },
434 {"orange4" , PALETTERGB (139, 90, 0) },
435 {"DarkOrange1" , PALETTERGB (255, 127, 0) },
436 {"DarkOrange2" , PALETTERGB (238, 118, 0) },
437 {"DarkOrange3" , PALETTERGB (205, 102, 0) },
438 {"DarkOrange4" , PALETTERGB (139, 69, 0) },
439 {"coral1" , PALETTERGB (255, 114, 86) },
440 {"coral2" , PALETTERGB (238, 106, 80) },
441 {"coral3" , PALETTERGB (205, 91, 69) },
442 {"coral4" , PALETTERGB (139, 62, 47) },
443 {"tomato1" , PALETTERGB (255, 99, 71) },
444 {"tomato2" , PALETTERGB (238, 92, 66) },
445 {"tomato3" , PALETTERGB (205, 79, 57) },
446 {"tomato4" , PALETTERGB (139, 54, 38) },
447 {"OrangeRed1" , PALETTERGB (255, 69, 0) },
448 {"OrangeRed2" , PALETTERGB (238, 64, 0) },
449 {"OrangeRed3" , PALETTERGB (205, 55, 0) },
450 {"OrangeRed4" , PALETTERGB (139, 37, 0) },
451 {"red1" , PALETTERGB (255, 0, 0) },
452 {"red2" , PALETTERGB (238, 0, 0) },
453 {"red3" , PALETTERGB (205, 0, 0) },
454 {"red4" , PALETTERGB (139, 0, 0) },
455 {"DeepPink1" , PALETTERGB (255, 20, 147) },
456 {"DeepPink2" , PALETTERGB (238, 18, 137) },
457 {"DeepPink3" , PALETTERGB (205, 16, 118) },
458 {"DeepPink4" , PALETTERGB (139, 10, 80) },
459 {"HotPink1" , PALETTERGB (255, 110, 180) },
460 {"HotPink2" , PALETTERGB (238, 106, 167) },
461 {"HotPink3" , PALETTERGB (205, 96, 144) },
462 {"HotPink4" , PALETTERGB (139, 58, 98) },
463 {"pink1" , PALETTERGB (255, 181, 197) },
464 {"pink2" , PALETTERGB (238, 169, 184) },
465 {"pink3" , PALETTERGB (205, 145, 158) },
466 {"pink4" , PALETTERGB (139, 99, 108) },
467 {"LightPink1" , PALETTERGB (255, 174, 185) },
468 {"LightPink2" , PALETTERGB (238, 162, 173) },
469 {"LightPink3" , PALETTERGB (205, 140, 149) },
470 {"LightPink4" , PALETTERGB (139, 95, 101) },
471 {"PaleVioletRed1" , PALETTERGB (255, 130, 171) },
472 {"PaleVioletRed2" , PALETTERGB (238, 121, 159) },
473 {"PaleVioletRed3" , PALETTERGB (205, 104, 137) },
474 {"PaleVioletRed4" , PALETTERGB (139, 71, 93) },
475 {"maroon1" , PALETTERGB (255, 52, 179) },
476 {"maroon2" , PALETTERGB (238, 48, 167) },
477 {"maroon3" , PALETTERGB (205, 41, 144) },
478 {"maroon4" , PALETTERGB (139, 28, 98) },
479 {"VioletRed1" , PALETTERGB (255, 62, 150) },
480 {"VioletRed2" , PALETTERGB (238, 58, 140) },
481 {"VioletRed3" , PALETTERGB (205, 50, 120) },
482 {"VioletRed4" , PALETTERGB (139, 34, 82) },
483 {"magenta1" , PALETTERGB (255, 0, 255) },
484 {"magenta2" , PALETTERGB (238, 0, 238) },
485 {"magenta3" , PALETTERGB (205, 0, 205) },
486 {"magenta4" , PALETTERGB (139, 0, 139) },
487 {"orchid1" , PALETTERGB (255, 131, 250) },
488 {"orchid2" , PALETTERGB (238, 122, 233) },
489 {"orchid3" , PALETTERGB (205, 105, 201) },
490 {"orchid4" , PALETTERGB (139, 71, 137) },
491 {"plum1" , PALETTERGB (255, 187, 255) },
492 {"plum2" , PALETTERGB (238, 174, 238) },
493 {"plum3" , PALETTERGB (205, 150, 205) },
494 {"plum4" , PALETTERGB (139, 102, 139) },
495 {"MediumOrchid1" , PALETTERGB (224, 102, 255) },
496 {"MediumOrchid2" , PALETTERGB (209, 95, 238) },
497 {"MediumOrchid3" , PALETTERGB (180, 82, 205) },
498 {"MediumOrchid4" , PALETTERGB (122, 55, 139) },
499 {"DarkOrchid1" , PALETTERGB (191, 62, 255) },
500 {"DarkOrchid2" , PALETTERGB (178, 58, 238) },
501 {"DarkOrchid3" , PALETTERGB (154, 50, 205) },
502 {"DarkOrchid4" , PALETTERGB (104, 34, 139) },
503 {"purple1" , PALETTERGB (155, 48, 255) },
504 {"purple2" , PALETTERGB (145, 44, 238) },
505 {"purple3" , PALETTERGB (125, 38, 205) },
506 {"purple4" , PALETTERGB (85, 26, 139) },
507 {"MediumPurple1" , PALETTERGB (171, 130, 255) },
508 {"MediumPurple2" , PALETTERGB (159, 121, 238) },
509 {"MediumPurple3" , PALETTERGB (137, 104, 205) },
510 {"MediumPurple4" , PALETTERGB (93, 71, 139) },
511 {"thistle1" , PALETTERGB (255, 225, 255) },
512 {"thistle2" , PALETTERGB (238, 210, 238) },
513 {"thistle3" , PALETTERGB (205, 181, 205) },
514 {"thistle4" , PALETTERGB (139, 123, 139) },
515 {"gray0" , PALETTERGB (0, 0, 0) },
516 {"grey0" , PALETTERGB (0, 0, 0) },
517 {"gray1" , PALETTERGB (3, 3, 3) },
518 {"grey1" , PALETTERGB (3, 3, 3) },
519 {"gray2" , PALETTERGB (5, 5, 5) },
520 {"grey2" , PALETTERGB (5, 5, 5) },
521 {"gray3" , PALETTERGB (8, 8, 8) },
522 {"grey3" , PALETTERGB (8, 8, 8) },
523 {"gray4" , PALETTERGB (10, 10, 10) },
524 {"grey4" , PALETTERGB (10, 10, 10) },
525 {"gray5" , PALETTERGB (13, 13, 13) },
526 {"grey5" , PALETTERGB (13, 13, 13) },
527 {"gray6" , PALETTERGB (15, 15, 15) },
528 {"grey6" , PALETTERGB (15, 15, 15) },
529 {"gray7" , PALETTERGB (18, 18, 18) },
530 {"grey7" , PALETTERGB (18, 18, 18) },
531 {"gray8" , PALETTERGB (20, 20, 20) },
532 {"grey8" , PALETTERGB (20, 20, 20) },
533 {"gray9" , PALETTERGB (23, 23, 23) },
534 {"grey9" , PALETTERGB (23, 23, 23) },
535 {"gray10" , PALETTERGB (26, 26, 26) },
536 {"grey10" , PALETTERGB (26, 26, 26) },
537 {"gray11" , PALETTERGB (28, 28, 28) },
538 {"grey11" , PALETTERGB (28, 28, 28) },
539 {"gray12" , PALETTERGB (31, 31, 31) },
540 {"grey12" , PALETTERGB (31, 31, 31) },
541 {"gray13" , PALETTERGB (33, 33, 33) },
542 {"grey13" , PALETTERGB (33, 33, 33) },
543 {"gray14" , PALETTERGB (36, 36, 36) },
544 {"grey14" , PALETTERGB (36, 36, 36) },
545 {"gray15" , PALETTERGB (38, 38, 38) },
546 {"grey15" , PALETTERGB (38, 38, 38) },
547 {"gray16" , PALETTERGB (41, 41, 41) },
548 {"grey16" , PALETTERGB (41, 41, 41) },
549 {"gray17" , PALETTERGB (43, 43, 43) },
550 {"grey17" , PALETTERGB (43, 43, 43) },
551 {"gray18" , PALETTERGB (46, 46, 46) },
552 {"grey18" , PALETTERGB (46, 46, 46) },
553 {"gray19" , PALETTERGB (48, 48, 48) },
554 {"grey19" , PALETTERGB (48, 48, 48) },
555 {"gray20" , PALETTERGB (51, 51, 51) },
556 {"grey20" , PALETTERGB (51, 51, 51) },
557 {"gray21" , PALETTERGB (54, 54, 54) },
558 {"grey21" , PALETTERGB (54, 54, 54) },
559 {"gray22" , PALETTERGB (56, 56, 56) },
560 {"grey22" , PALETTERGB (56, 56, 56) },
561 {"gray23" , PALETTERGB (59, 59, 59) },
562 {"grey23" , PALETTERGB (59, 59, 59) },
563 {"gray24" , PALETTERGB (61, 61, 61) },
564 {"grey24" , PALETTERGB (61, 61, 61) },
565 {"gray25" , PALETTERGB (64, 64, 64) },
566 {"grey25" , PALETTERGB (64, 64, 64) },
567 {"gray26" , PALETTERGB (66, 66, 66) },
568 {"grey26" , PALETTERGB (66, 66, 66) },
569 {"gray27" , PALETTERGB (69, 69, 69) },
570 {"grey27" , PALETTERGB (69, 69, 69) },
571 {"gray28" , PALETTERGB (71, 71, 71) },
572 {"grey28" , PALETTERGB (71, 71, 71) },
573 {"gray29" , PALETTERGB (74, 74, 74) },
574 {"grey29" , PALETTERGB (74, 74, 74) },
575 {"gray30" , PALETTERGB (77, 77, 77) },
576 {"grey30" , PALETTERGB (77, 77, 77) },
577 {"gray31" , PALETTERGB (79, 79, 79) },
578 {"grey31" , PALETTERGB (79, 79, 79) },
579 {"gray32" , PALETTERGB (82, 82, 82) },
580 {"grey32" , PALETTERGB (82, 82, 82) },
581 {"gray33" , PALETTERGB (84, 84, 84) },
582 {"grey33" , PALETTERGB (84, 84, 84) },
583 {"gray34" , PALETTERGB (87, 87, 87) },
584 {"grey34" , PALETTERGB (87, 87, 87) },
585 {"gray35" , PALETTERGB (89, 89, 89) },
586 {"grey35" , PALETTERGB (89, 89, 89) },
587 {"gray36" , PALETTERGB (92, 92, 92) },
588 {"grey36" , PALETTERGB (92, 92, 92) },
589 {"gray37" , PALETTERGB (94, 94, 94) },
590 {"grey37" , PALETTERGB (94, 94, 94) },
591 {"gray38" , PALETTERGB (97, 97, 97) },
592 {"grey38" , PALETTERGB (97, 97, 97) },
593 {"gray39" , PALETTERGB (99, 99, 99) },
594 {"grey39" , PALETTERGB (99, 99, 99) },
595 {"gray40" , PALETTERGB (102, 102, 102) },
596 {"grey40" , PALETTERGB (102, 102, 102) },
597 {"gray41" , PALETTERGB (105, 105, 105) },
598 {"grey41" , PALETTERGB (105, 105, 105) },
599 {"gray42" , PALETTERGB (107, 107, 107) },
600 {"grey42" , PALETTERGB (107, 107, 107) },
601 {"gray43" , PALETTERGB (110, 110, 110) },
602 {"grey43" , PALETTERGB (110, 110, 110) },
603 {"gray44" , PALETTERGB (112, 112, 112) },
604 {"grey44" , PALETTERGB (112, 112, 112) },
605 {"gray45" , PALETTERGB (115, 115, 115) },
606 {"grey45" , PALETTERGB (115, 115, 115) },
607 {"gray46" , PALETTERGB (117, 117, 117) },
608 {"grey46" , PALETTERGB (117, 117, 117) },
609 {"gray47" , PALETTERGB (120, 120, 120) },
610 {"grey47" , PALETTERGB (120, 120, 120) },
611 {"gray48" , PALETTERGB (122, 122, 122) },
612 {"grey48" , PALETTERGB (122, 122, 122) },
613 {"gray49" , PALETTERGB (125, 125, 125) },
614 {"grey49" , PALETTERGB (125, 125, 125) },
615 {"gray50" , PALETTERGB (128, 128, 128) }, /* Adjusted */
616 {"grey50" , PALETTERGB (128, 128, 128) }, /* Adjusted */
617 {"gray51" , PALETTERGB (130, 130, 130) },
618 {"grey51" , PALETTERGB (130, 130, 130) },
619 {"gray52" , PALETTERGB (133, 133, 133) },
620 {"grey52" , PALETTERGB (133, 133, 133) },
621 {"gray53" , PALETTERGB (135, 135, 135) },
622 {"grey53" , PALETTERGB (135, 135, 135) },
623 {"gray54" , PALETTERGB (138, 138, 138) },
624 {"grey54" , PALETTERGB (138, 138, 138) },
625 {"gray55" , PALETTERGB (140, 140, 140) },
626 {"grey55" , PALETTERGB (140, 140, 140) },
627 {"gray56" , PALETTERGB (143, 143, 143) },
628 {"grey56" , PALETTERGB (143, 143, 143) },
629 {"gray57" , PALETTERGB (145, 145, 145) },
630 {"grey57" , PALETTERGB (145, 145, 145) },
631 {"gray58" , PALETTERGB (148, 148, 148) },
632 {"grey58" , PALETTERGB (148, 148, 148) },
633 {"gray59" , PALETTERGB (150, 150, 150) },
634 {"grey59" , PALETTERGB (150, 150, 150) },
635 {"gray60" , PALETTERGB (153, 153, 153) },
636 {"grey60" , PALETTERGB (153, 153, 153) },
637 {"gray61" , PALETTERGB (156, 156, 156) },
638 {"grey61" , PALETTERGB (156, 156, 156) },
639 {"gray62" , PALETTERGB (158, 158, 158) },
640 {"grey62" , PALETTERGB (158, 158, 158) },
641 {"gray63" , PALETTERGB (161, 161, 161) },
642 {"grey63" , PALETTERGB (161, 161, 161) },
643 {"gray64" , PALETTERGB (163, 163, 163) },
644 {"grey64" , PALETTERGB (163, 163, 163) },
645 {"gray65" , PALETTERGB (166, 166, 166) },
646 {"grey65" , PALETTERGB (166, 166, 166) },
647 {"gray66" , PALETTERGB (168, 168, 168) },
648 {"grey66" , PALETTERGB (168, 168, 168) },
649 {"gray67" , PALETTERGB (171, 171, 171) },
650 {"grey67" , PALETTERGB (171, 171, 171) },
651 {"gray68" , PALETTERGB (173, 173, 173) },
652 {"grey68" , PALETTERGB (173, 173, 173) },
653 {"gray69" , PALETTERGB (176, 176, 176) },
654 {"grey69" , PALETTERGB (176, 176, 176) },
655 {"gray70" , PALETTERGB (179, 179, 179) },
656 {"grey70" , PALETTERGB (179, 179, 179) },
657 {"gray71" , PALETTERGB (181, 181, 181) },
658 {"grey71" , PALETTERGB (181, 181, 181) },
659 {"gray72" , PALETTERGB (184, 184, 184) },
660 {"grey72" , PALETTERGB (184, 184, 184) },
661 {"gray73" , PALETTERGB (186, 186, 186) },
662 {"grey73" , PALETTERGB (186, 186, 186) },
663 {"gray74" , PALETTERGB (189, 189, 189) },
664 {"grey74" , PALETTERGB (189, 189, 189) },
665 {"gray75" , PALETTERGB (192, 192, 192) }, /* Adjusted */
666 {"grey75" , PALETTERGB (192, 192, 192) }, /* Adjusted */
667 {"gray76" , PALETTERGB (194, 194, 194) },
668 {"grey76" , PALETTERGB (194, 194, 194) },
669 {"gray77" , PALETTERGB (196, 196, 196) },
670 {"grey77" , PALETTERGB (196, 196, 196) },
671 {"gray78" , PALETTERGB (199, 199, 199) },
672 {"grey78" , PALETTERGB (199, 199, 199) },
673 {"gray79" , PALETTERGB (201, 201, 201) },
674 {"grey79" , PALETTERGB (201, 201, 201) },
675 {"gray80" , PALETTERGB (204, 204, 204) },
676 {"grey80" , PALETTERGB (204, 204, 204) },
677 {"gray81" , PALETTERGB (207, 207, 207) },
678 {"grey81" , PALETTERGB (207, 207, 207) },
679 {"gray82" , PALETTERGB (209, 209, 209) },
680 {"grey82" , PALETTERGB (209, 209, 209) },
681 {"gray83" , PALETTERGB (212, 212, 212) },
682 {"grey83" , PALETTERGB (212, 212, 212) },
683 {"gray84" , PALETTERGB (214, 214, 214) },
684 {"grey84" , PALETTERGB (214, 214, 214) },
685 {"gray85" , PALETTERGB (217, 217, 217) },
686 {"grey85" , PALETTERGB (217, 217, 217) },
687 {"gray86" , PALETTERGB (219, 219, 219) },
688 {"grey86" , PALETTERGB (219, 219, 219) },
689 {"gray87" , PALETTERGB (222, 222, 222) },
690 {"grey87" , PALETTERGB (222, 222, 222) },
691 {"gray88" , PALETTERGB (224, 224, 224) },
692 {"grey88" , PALETTERGB (224, 224, 224) },
693 {"gray89" , PALETTERGB (227, 227, 227) },
694 {"grey89" , PALETTERGB (227, 227, 227) },
695 {"gray90" , PALETTERGB (229, 229, 229) },
696 {"grey90" , PALETTERGB (229, 229, 229) },
697 {"gray91" , PALETTERGB (232, 232, 232) },
698 {"grey91" , PALETTERGB (232, 232, 232) },
699 {"gray92" , PALETTERGB (235, 235, 235) },
700 {"grey92" , PALETTERGB (235, 235, 235) },
701 {"gray93" , PALETTERGB (237, 237, 237) },
702 {"grey93" , PALETTERGB (237, 237, 237) },
703 {"gray94" , PALETTERGB (240, 240, 240) },
704 {"grey94" , PALETTERGB (240, 240, 240) },
705 {"gray95" , PALETTERGB (242, 242, 242) },
706 {"grey95" , PALETTERGB (242, 242, 242) },
707 {"gray96" , PALETTERGB (245, 245, 245) },
708 {"grey96" , PALETTERGB (245, 245, 245) },
709 {"gray97" , PALETTERGB (247, 247, 247) },
710 {"grey97" , PALETTERGB (247, 247, 247) },
711 {"gray98" , PALETTERGB (250, 250, 250) },
712 {"grey98" , PALETTERGB (250, 250, 250) },
713 {"gray99" , PALETTERGB (252, 252, 252) },
714 {"grey99" , PALETTERGB (252, 252, 252) },
715 {"gray100" , PALETTERGB (255, 255, 255) },
716 {"grey100" , PALETTERGB (255, 255, 255) },
717 {"DarkGrey" , PALETTERGB (169, 169, 169) },
718 {"DarkGray" , PALETTERGB (169, 169, 169) },
719 {"DarkBlue" , PALETTERGB (0, 0, 128) }, /* Adjusted == Navy */
720 {"DarkCyan" , PALETTERGB (0, 128, 128) }, /* Adjusted */
721 {"DarkMagenta" , PALETTERGB (128, 0, 128) }, /* Adjusted */
722 {"DarkRed" , PALETTERGB (128, 0, 0) }, /* Adjusted */
723 {"LightGreen" , PALETTERGB (144, 238, 144) },
724 /* Added to match values in the default Windows palette: */
725 {"DarkYellow" , PALETTERGB (128, 128, 0) },
726 {"PaleYellow" , PALETTERGB (255, 255, 128) }
730 typedef struct fontmap_t
736 /* Default weight first, preferred names listed before synonyms */
737 static const fontmap_t fontweight_map[] =
739 {"Regular" , FW_REGULAR}, /* The standard font weight */
741 {"Extra Light" , FW_EXTRALIGHT},
742 {"Ultra Light" , FW_ULTRALIGHT},
743 {"Light" , FW_LIGHT},
744 {"Normal" , FW_NORMAL},
745 {"Medium" , FW_MEDIUM},
746 {"Semi Bold" , FW_SEMIBOLD},
747 {"Demi Bold" , FW_DEMIBOLD},
748 {"Bold" , FW_BOLD}, /* The standard bold font weight */
749 {"Extra Bold" , FW_EXTRABOLD},
750 {"Ultra Bold" , FW_ULTRABOLD},
751 {"Heavy" , FW_HEAVY},
755 /* Default charset first, no synonyms allowed because these names are
756 * matched against the names reported by win32 by match_font() */
757 static const fontmap_t charset_map[] =
759 {"Western" , ANSI_CHARSET},
760 {"Symbol" , SYMBOL_CHARSET},
761 {"Shift JIS" , SHIFTJIS_CHARSET}, /* #### Name to be verified */
762 {"GB2312" , GB2312_CHARSET}, /* #### Name to be verified */
763 {"Hanguel" , HANGEUL_CHARSET},
764 {"Chinese Big 5" , CHINESEBIG5_CHARSET}, /* #### Name to be verified */
765 #if (WINVER >= 0x0400)
766 {"Johab" , JOHAB_CHARSET}, /* #### Name to be verified */
767 {"Hebrew" , HEBREW_CHARSET}, /* #### Name to be verified */
768 {"Arabic" , ARABIC_CHARSET}, /* #### Name to be verified */
769 {"Greek" , GREEK_CHARSET},
770 {"Turkish" , TURKISH_CHARSET},
771 {"Vietnamese" , VIETNAMESE_CHARSET}, /* #### Name to be verified */
772 {"Thai" , THAI_CHARSET}, /* #### Name to be verified */
773 {"Central European" , EASTEUROPE_CHARSET},
774 {"Cyrillic" , RUSSIAN_CHARSET},
775 {"Mac" , MAC_CHARSET},
776 {"Baltic" , BALTIC_CHARSET},
778 {"OEM/DOS" , OEM_CHARSET}
782 /************************************************************************/
784 /************************************************************************/
789 /* assumes ASCII and isxdigit(c) */
799 mswindows_string_to_color(const char *name)
805 /* numeric names look like "#RRGGBB", "#RRRGGGBBB" or "#RRRRGGGGBBBB"
806 or "rgb:rrrr/gggg/bbbb" */
807 unsigned int r, g, b;
809 for (i=1; i<strlen(name); i++)
811 if (!isxdigit ((int)name[i]))
812 return (COLORREF) -1;
816 r = hexval (name[1]) * 16 + hexval (name[2]);
817 g = hexval (name[3]) * 16 + hexval (name[4]);
818 b = hexval (name[5]) * 16 + hexval (name[6]);
819 return (PALETTERGB (r, g, b));
821 else if (strlen(name)==10)
823 r = hexval (name[1]) * 16 + hexval (name[2]);
824 g = hexval (name[4]) * 16 + hexval (name[5]);
825 b = hexval (name[7]) * 16 + hexval (name[8]);
826 return (PALETTERGB (r, g, b));
828 else if (strlen(name)==13)
830 r = hexval (name[1]) * 16 + hexval (name[2]);
831 g = hexval (name[5]) * 16 + hexval (name[6]);
832 b = hexval (name[9]) * 16 + hexval (name[10]);
833 return (PALETTERGB (r, g, b));
836 else if (!strncmp(name, "rgb:", 4))
840 if (sscanf(name, "rgb:%04x/%04x/%04x", &r, &g, &b) == 3)
842 int len = strlen (name);
855 return (PALETTERGB (r, g, b));
858 return (COLORREF) -1;
860 else if (*name) /* Can't be an empty string */
862 char *nospaces = (char*) alloca (strlen (name)+1);
871 for (i = 0; i < countof (mswindows_X_color_map); i++)
872 if (!stricmp (nospaces, mswindows_X_color_map[i].name))
873 return (mswindows_X_color_map[i].colorref);
875 return (COLORREF) -1;
879 mswindows_color_to_string (COLORREF color)
883 COLORREF pcolor = PALETTERGB (GetRValue (color), GetGValue (color),
886 for (i=0; i < countof (mswindows_X_color_map); i++)
887 if (pcolor == (mswindows_X_color_map[i].colorref))
888 return build_string (mswindows_X_color_map[i].name);
890 sprintf (buf, "#%02X%02X%02X",
891 GetRValue (color), GetGValue (color), GetBValue (color));
892 return build_string (buf);
896 * Returns non-zero if the two supplied font patterns match.
897 * If they match and fontname is not NULL, copies the logical OR of the
898 * patterns to fontname (which is assumed to be at least MSW_FONTSIZE in size).
900 * The patterns 'match' iff for each field that is not blank in either pattern,
901 * the corresponding field in the other pattern is either identical or blank.
904 match_font (char *pattern1, char *pattern2, char *fontname)
906 char *c1=pattern1, *c2=pattern2, *e1=0, *e2=0;
914 if (c1 && (e1 = strchr (c1, ':')))
916 if (c2 && (e2 = strchr (c2, ':')))
919 if (c1 && c1[0]!='\0')
921 if (c2 && c2[0]!='\0' && stricmp(c1, c2))
928 strcat (strcat (fontname, c1), ":");
932 if (c2 && c2[0]!='\0')
933 strcat (strcat (fontname, c2), ":");
935 strcat (fontname, ":");
938 if (e1) *(e1++) = ':';
939 if (e2) *(e2++) = ':';
945 fontname[strlen (fontname) - 1] = '\0'; /* Trim trailing ':' */
953 /************************************************************************/
955 /************************************************************************/
964 old_font_enum_callback_2 (ENUMLOGFONT FAR *lpelfe, NEWTEXTMETRIC FAR *lpntme,
965 int FontType, struct font_enum_t *font_enum)
967 char fontname[MSW_FONTSIZE];
968 Lisp_Object fontname_lispstr;
972 * The enumerated font weights are not to be trusted because:
973 * a) lpelfe->elfStyle is only filled in for TrueType fonts.
974 * b) Not all Bold and Italic styles of all fonts (including some Vector,
975 * Truetype and Raster fonts) are enumerated.
976 * I guess that fonts for which Bold and Italic styles are generated
977 * 'on-the-fly' are not enumerated. It would be overly restrictive to
978 * disallow Bold And Italic weights for these fonts, so we just leave
979 * weights unspecified. This means that we have to weed out duplicates of
980 * those fonts that do get enumerated with different weights.
982 if (FontType == 0 /*vector*/ || FontType == TRUETYPE_FONTTYPE)
983 /* Scalable, so leave pointsize blank */
984 sprintf (fontname, "%s::::", lpelfe->elfLogFont.lfFaceName);
986 /* Formula for pointsize->height from LOGFONT docs in Platform SDK */
987 sprintf (fontname, "%s::%d::", lpelfe->elfLogFont.lfFaceName,
988 MulDiv (lpntme->tmHeight - lpntme->tmInternalLeading,
989 72, GetDeviceCaps (font_enum->hdc, LOGPIXELSY)));
992 * The enumerated font character set strings are not to be trusted because
993 * lpelfe->elfScript is returned in the host language and not in English.
994 * We can't know a priori the translations of "Western", "Central European"
995 * etc into the host language, so we must use English. The same argument
996 * applies to the font weight string when matching fonts.
998 for (i=0; i<countof (charset_map); i++)
999 if (lpelfe->elfLogFont.lfCharSet == charset_map[i].value)
1001 strcat (fontname, charset_map[i].name);
1004 if (i==countof (charset_map))
1005 strcpy (fontname, charset_map[0].name);
1007 /* Add the font name to the list if not already there */
1008 fontname_lispstr = build_string (fontname);
1009 if (NILP (memq_no_quit (fontname_lispstr, font_enum->list)))
1010 font_enum->list = Fcons (fontname_lispstr, font_enum->list);
1016 old_font_enum_callback_1 (ENUMLOGFONT FAR *lpelfe, NEWTEXTMETRIC FAR *lpntme,
1017 int FontType, struct font_enum_t *font_enum)
1019 /* This function gets called once per facename per character set.
1020 * We call a second callback to enumerate the fonts in each facename */
1021 return EnumFontFamilies (font_enum->hdc, lpelfe->elfLogFont.lfFaceName,
1022 (FONTENUMPROC) old_font_enum_callback_2,
1023 (LPARAM) font_enum);
1027 font_enum_callback_2 (ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *lpntme,
1028 int FontType, struct font_enum_t *font_enum)
1030 char fontname[MSW_FONTSIZE];
1031 Lisp_Object fontname_lispstr;
1035 * The enumerated font weights are not to be trusted because:
1036 * a) lpelfe->elfStyle is only filled in for TrueType fonts.
1037 * b) Not all Bold and Italic styles of all fonts (including some Vector,
1038 * Truetype and Raster fonts) are enumerated.
1039 * I guess that fonts for which Bold and Italic styles are generated
1040 * 'on-the-fly' are not enumerated. It would be overly restrictive to
1041 * disallow Bold And Italic weights for these fonts, so we just leave
1042 * weights unspecified. This means that we have to weed out duplicates of
1043 * those fonts that do get enumerated with different weights.
1045 if (FontType == 0 /*vector*/ || FontType == TRUETYPE_FONTTYPE)
1046 /* Scalable, so leave pointsize blank */
1047 sprintf (fontname, "%s::::", lpelfe->elfLogFont.lfFaceName);
1049 /* Formula for pointsize->height from LOGFONT docs in Platform SDK */
1050 sprintf (fontname, "%s::%d::", lpelfe->elfLogFont.lfFaceName,
1051 MulDiv (lpntme->ntmTm.tmHeight - lpntme->ntmTm.tmInternalLeading,
1052 72, GetDeviceCaps (font_enum->hdc, LOGPIXELSY)));
1055 * The enumerated font character set strings are not to be trusted because
1056 * lpelfe->elfScript is returned in the host language and not in English.
1057 * We can't know a priori the translations of "Western", "Central European"
1058 * etc into the host language, so we must use English. The same argument
1059 * applies to the font weight string when matching fonts.
1061 for (i=0; i<countof (charset_map); i++)
1062 if (lpelfe->elfLogFont.lfCharSet == charset_map[i].value)
1064 strcat (fontname, charset_map[i].name);
1067 if (i==countof (charset_map))
1068 strcpy (fontname, charset_map[0].name);
1070 /* Add the font name to the list if not already there */
1071 fontname_lispstr = build_string (fontname);
1072 if (NILP (memq_no_quit (fontname_lispstr, font_enum->list)))
1073 font_enum->list = Fcons (fontname_lispstr, font_enum->list);
1079 font_enum_callback_1 (ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *lpntme,
1080 int FontType, struct font_enum_t *font_enum)
1082 /* This function gets called once per facename per character set.
1083 * We call a second callback to enumerate the fonts in each facename */
1084 return xEnumFontFamiliesExA (font_enum->hdc, &lpelfe->elfLogFont,
1085 (FONTENUMPROC) font_enum_callback_2,
1086 (LPARAM) font_enum, 0);
1090 * Enumerate the available on the HDC fonts and return a list of string
1094 mswindows_enumerate_fonts (HDC hdc)
1096 /* This cannot CG */
1098 struct font_enum_t font_enum;
1101 logfont.lfCharSet = DEFAULT_CHARSET;
1102 logfont.lfFaceName[0] = '\0';
1103 logfont.lfPitchAndFamily = DEFAULT_PITCH;
1104 font_enum.hdc = hdc;
1105 font_enum.list = Qnil;
1106 if (xEnumFontFamiliesExA)
1107 xEnumFontFamiliesExA (hdc, &logfont, (FONTENUMPROC) font_enum_callback_1,
1108 (LPARAM) (&font_enum), 0);
1110 EnumFontFamilies (hdc, 0, (FONTENUMPROC) old_font_enum_callback_1,
1111 (LPARAM) (&font_enum));
1113 return font_enum.list;
1117 mswindows_create_font_variant (Lisp_Font_Instance* f,
1118 int under, int strike)
1125 assert (FONT_INSTANCE_MSWINDOWS_HFONT_VARIANT (f, under, strike) == NULL);
1127 if (GetObject (FONT_INSTANCE_MSWINDOWS_HFONT_VARIANT (f, 0, 0),
1128 sizeof (lf), (void*) &lf) == 0)
1130 hfont = MSWINDOWS_BAD_HFONT;
1134 lf.lfUnderline = under;
1135 lf.lfStrikeOut = strike;
1137 hfont = CreateFontIndirect (&lf);
1139 hfont = MSWINDOWS_BAD_HFONT;
1142 FONT_INSTANCE_MSWINDOWS_HFONT_VARIANT (f, under, strike) = hfont;
1147 mswindows_get_hfont (Lisp_Font_Instance* f,
1148 int under, int strike)
1151 HFONT hfont = FONT_INSTANCE_MSWINDOWS_HFONT_VARIANT (f, under, strike);
1154 hfont = mswindows_create_font_variant (f, under, strike);
1156 /* If strikeout/underline variant of the font could not be
1157 created, then use the base version of the font */
1158 if (hfont == MSWINDOWS_BAD_HFONT)
1159 hfont = FONT_INSTANCE_MSWINDOWS_HFONT_VARIANT (f, 0, 0);
1161 assert (hfont != NULL && hfont != MSWINDOWS_BAD_HFONT);
1166 /************************************************************************/
1168 /************************************************************************/
1171 mswindows_initialize_color_instance (Lisp_Color_Instance *c, Lisp_Object name,
1172 Lisp_Object device, Error_behavior errb)
1174 const char *extname;
1177 TO_EXTERNAL_FORMAT (LISP_STRING, name,
1178 C_STRING_ALLOCA, extname,
1180 color = mswindows_string_to_color(extname);
1183 c->data = xnew (struct mswindows_color_instance_data);
1184 COLOR_INSTANCE_MSWINDOWS_COLOR (c) = color;
1187 maybe_signal_simple_error ("Unrecognized color", name, Qcolor, errb);
1193 mswindows_mark_color_instance (Lisp_Color_Instance *c)
1199 mswindows_print_color_instance (Lisp_Color_Instance *c,
1200 Lisp_Object printcharfun,
1204 COLORREF color = COLOR_INSTANCE_MSWINDOWS_COLOR (c);
1205 sprintf (buf, " %06ld=(%04X,%04X,%04X)", color & 0xffffff,
1206 GetRValue(color)*257, GetGValue(color)*257, GetBValue(color)*257);
1207 write_c_string (buf, printcharfun);
1211 mswindows_finalize_color_instance (Lisp_Color_Instance *c)
1221 mswindows_color_instance_equal (Lisp_Color_Instance *c1,
1222 Lisp_Color_Instance *c2,
1225 return (COLOR_INSTANCE_MSWINDOWS_COLOR(c1) == COLOR_INSTANCE_MSWINDOWS_COLOR(c2));
1228 static unsigned long
1229 mswindows_color_instance_hash (Lisp_Color_Instance *c, int depth)
1231 return (unsigned long) COLOR_INSTANCE_MSWINDOWS_COLOR(c);
1235 mswindows_color_instance_rgb_components (Lisp_Color_Instance *c)
1237 COLORREF color = COLOR_INSTANCE_MSWINDOWS_COLOR (c);
1238 return list3 (make_int (GetRValue (color) * 257),
1239 make_int (GetGValue (color) * 257),
1240 make_int (GetBValue (color) * 257));
1244 mswindows_valid_color_name_p (struct device *d, Lisp_Object color)
1246 const char *extname;
1248 TO_EXTERNAL_FORMAT (LISP_STRING, color,
1249 C_STRING_ALLOCA, extname,
1251 return (mswindows_string_to_color(extname)!=-1);
1257 mswindows_finalize_font_instance (Lisp_Font_Instance *f);
1260 * This is a work horse for both mswindows_initialize_font_instance and
1261 * msprinter_initialize_font_instance.
1264 initialize_font_instance (Lisp_Font_Instance *f, Lisp_Object name,
1265 Lisp_Object device_font_list, HDC hdc,
1266 Error_behavior errb)
1268 const char *extname;
1272 char fontname[LF_FACESIZE], weight[LF_FACESIZE], *style, points[8];
1273 char effects[LF_FACESIZE], charset[LF_FACESIZE];
1275 HFONT hfont, hfont2;
1278 extname = XSTRING_DATA (name);
1281 * mswindows fonts look like:
1282 * fontname[:[weight ][style][:pointsize[:effects]]][:charset]
1283 * The font name field shouldn't be empty.
1286 * Lucida Console:Regular:10
1290 * Courier New:Bold Italic:10:underline strikeout:western
1293 fields = sscanf (extname, "%31[^:]:%31[^:]:%7[^:]:%31[^:]:%31s",
1294 fontname, weight, points, effects, charset);
1296 /* This function is implemented in a fairly ad-hoc manner.
1297 * The general idea is to validate and canonicalize each of the above fields
1298 * at the same time as we build up the win32 LOGFONT structure. This enables
1299 * us to use match_font() on a canonicalized font string to check the
1300 * availability of the requested font */
1304 maybe_signal_simple_error ("Invalid font", name, Qfont, errb);
1308 if (fields>0 && strlen(fontname))
1310 strncpy (logfont.lfFaceName, fontname, LF_FACESIZE);
1311 logfont.lfFaceName[LF_FACESIZE-1] = 0;
1315 maybe_signal_simple_error ("Must specify a font name", name, Qfont, errb);
1321 strcpy (weight, fontweight_map[0].name);
1323 /* Maybe split weight into weight and style */
1324 if ((c=strchr(weight, ' ')))
1332 for (i=0; i<countof (fontweight_map); i++)
1333 if (!stricmp (weight, fontweight_map[i].name))
1335 logfont.lfWeight = fontweight_map[i].value;
1338 if (i == countof (fontweight_map)) /* No matching weight */
1342 logfont.lfWeight = FW_REGULAR;
1343 style = weight; /* May have specified style without weight */
1347 maybe_signal_simple_error ("Invalid font weight", name, Qfont, errb);
1354 /* #### what about oblique? */
1355 if (stricmp (style,"italic") == 0)
1356 logfont.lfItalic = TRUE;
1359 maybe_signal_simple_error ("Invalid font weight or style", name, Qfont, errb);
1363 /* Glue weight and style together again */
1364 if (weight != style)
1368 logfont.lfItalic = FALSE;
1371 pt = 10; /* #### Should we reject strings that don't specify a size? */
1372 else if ((pt=atoi(points)) == 0)
1374 maybe_signal_simple_error ("Invalid font pointsize", name, Qfont, errb);
1378 /* Formula for pointsize->height from LOGFONT docs in MSVC5 Platform SDK */
1379 logfont.lfHeight = -MulDiv(pt, GetDeviceCaps (hdc, LOGPIXELSY), 72);
1380 logfont.lfWidth = 0;
1383 logfont.lfUnderline = FALSE;
1384 logfont.lfStrikeOut = FALSE;
1385 if (fields >= 4 && effects[0] != '\0')
1389 /* Maybe split effects into effects and effects2 */
1390 if ((c=strchr (effects, ' ')))
1398 if (stricmp (effects, "underline") == 0)
1399 logfont.lfUnderline = TRUE;
1400 else if (stricmp (effects, "strikeout") == 0)
1401 logfont.lfStrikeOut = TRUE;
1404 maybe_signal_simple_error ("Invalid font effect", name, Qfont, errb);
1408 if (effects2 && effects2[0] != '\0')
1410 if (stricmp (effects2, "underline") == 0)
1411 logfont.lfUnderline = TRUE;
1412 else if (stricmp (effects2, "strikeout") == 0)
1413 logfont.lfStrikeOut = TRUE;
1416 maybe_signal_simple_error ("Invalid font effect", name,
1422 /* Regenerate sanitised effects string */
1423 if (logfont.lfUnderline)
1425 if (logfont.lfStrikeOut)
1426 strcpy (effects, "underline strikeout");
1428 strcpy (effects, "underline");
1430 else if (logfont.lfStrikeOut)
1431 strcpy (effects, "strikeout");
1437 /* charset can be specified even if earlier fields haven't been */
1440 if ((c=strchr (extname, ':')) && (c=strchr (c+1, ':')) &&
1441 (c=strchr (c+1, ':')) && (c=strchr (c+1, ':')))
1443 strncpy (charset, c+1, LF_FACESIZE);
1444 charset[LF_FACESIZE-1] = '\0';
1447 strcpy (charset, charset_map[0].name);
1450 for (i=0; i<countof (charset_map); i++)
1451 if (!stricmp (charset, charset_map[i].name))
1453 logfont.lfCharSet = charset_map[i].value;
1457 if (i == countof (charset_map)) /* No matching charset */
1459 maybe_signal_simple_error ("Invalid charset", name, Qfont, errb);
1464 logfont.lfEscapement = logfont.lfOrientation = 0;
1466 logfont.lfOutPrecision = OUT_DEFAULT_PRECIS;
1467 logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
1468 logfont.lfQuality = DEFAULT_QUALITY;
1470 logfont.lfOutPrecision = OUT_STROKE_PRECIS;
1471 logfont.lfClipPrecision = CLIP_STROKE_PRECIS;
1472 logfont.lfQuality = PROOF_QUALITY;
1474 /* Default to monospaced if the specified fontname doesn't exist. */
1475 logfont.lfPitchAndFamily = FF_MODERN;
1477 /* Windows will silently substitute a default font if the fontname specifies
1478 a non-existent font. This is bad for screen fonts because it doesn't
1479 allow higher-level code to see the error and to act appropriately.
1480 For instance complex_vars_of_faces() sets up a fallback list of fonts
1481 for the default face. */
1483 if (!NILP (device_font_list))
1485 Lisp_Object fonttail;
1486 char truename[MSW_FONTSIZE];
1488 sprintf (truename, "%s:%s:%d:%s:%s", fontname, weight, pt, effects, charset);
1489 LIST_LOOP (fonttail, device_font_list)
1491 if (match_font (XSTRING_DATA (XCAR (fonttail)), truename, NULL))
1494 if (NILP (fonttail))
1496 maybe_signal_simple_error ("No matching font", name, Qfont, errb);
1501 if ((hfont = CreateFontIndirect(&logfont)) == NULL)
1503 maybe_signal_simple_error ("Couldn't create font", name, Qfont, errb);
1507 f->data = xnew_and_zero (struct mswindows_font_instance_data);
1508 FONT_INSTANCE_MSWINDOWS_HFONT_VARIANT (f,0,0) = hfont;
1510 /* Some underlined fonts have the descent of one pixel more than their
1511 non-underlined counterparts. Font variants though are assumed to have
1512 identical metrics. So get the font metrics from the underlined variant
1514 hfont2 = mswindows_create_font_variant (f, 1, 0);
1515 if (hfont2 != MSWINDOWS_BAD_HFONT)
1518 hfont2 = (HFONT) SelectObject (hdc, hfont);
1521 mswindows_finalize_font_instance (f);
1522 maybe_signal_simple_error ("Couldn't map font", name, Qfont, errb);
1525 GetTextMetrics (hdc, &metrics);
1526 SelectObject(hdc, hfont2);
1528 f->width = (unsigned short) metrics.tmAveCharWidth;
1529 f->height = (unsigned short) metrics.tmHeight;
1530 f->ascent = (unsigned short) metrics.tmAscent;
1531 f->descent = (unsigned short) metrics.tmDescent;
1532 f->proportional_p = (metrics.tmPitchAndFamily & TMPF_FIXED_PITCH);
1538 mswindows_initialize_font_instance (Lisp_Font_Instance *f, Lisp_Object name,
1539 Lisp_Object device, Error_behavior errb)
1541 HDC hdc = CreateCompatibleDC (NULL);
1542 Lisp_Object font_list = DEVICE_MSWINDOWS_FONTLIST (XDEVICE (device));
1543 int res = initialize_font_instance (f, name, font_list, hdc, errb);
1549 msprinter_initialize_font_instance (Lisp_Font_Instance *f, Lisp_Object name,
1550 Lisp_Object device, Error_behavior errb)
1552 HDC hdc = DEVICE_MSPRINTER_HDC (XDEVICE (device));
1553 Lisp_Object font_list = DEVICE_MSPRINTER_FONTLIST (XDEVICE (device));
1554 return initialize_font_instance (f, name, font_list, hdc, errb);
1558 mswindows_finalize_font_instance (Lisp_Font_Instance *f)
1564 for (i = 0; i < MSWINDOWS_NUM_FONT_VARIANTS; i++)
1566 if (FONT_INSTANCE_MSWINDOWS_HFONT_I (f, i) != NULL
1567 && FONT_INSTANCE_MSWINDOWS_HFONT_I (f, i) != MSWINDOWS_BAD_HFONT)
1568 DeleteObject (FONT_INSTANCE_MSWINDOWS_HFONT_I (f, i));
1578 mswindows_mark_font_instance (Lisp_Font_Instance *f)
1584 mswindows_print_font_instance (Lisp_Font_Instance *f,
1585 Lisp_Object printcharfun,
1589 sprintf (buf, " 0x%lx",
1590 (unsigned long)FONT_INSTANCE_MSWINDOWS_HFONT_VARIANT (f,0,0));
1591 write_c_string (buf, printcharfun);
1595 mswindows_list_fonts (Lisp_Object pattern, Lisp_Object device)
1597 Lisp_Object fonttail, result = Qnil;
1600 TO_EXTERNAL_FORMAT (LISP_STRING, pattern,
1601 C_STRING_ALLOCA, extpattern,
1604 LIST_LOOP (fonttail, DEVICE_MSWINDOWS_FONTLIST (XDEVICE (device)))
1606 if (match_font (XSTRING_DATA (XCAR (fonttail)), extpattern, NULL))
1607 result = Fcons (XCAR (fonttail), result);
1610 return Fnreverse (result);
1613 /* Fill in missing parts of a font spec. This is primarily intended as a
1614 * helper function for the functions below.
1615 * mswindows fonts look like:
1616 * fontname[:[weight][ style][:pointsize[:effects]]][:charset]
1617 * A minimal mswindows font spec looks like:
1619 * A maximal mswindows font spec looks like:
1620 * Courier New:Bold Italic:10:underline strikeout:Western
1621 * Missing parts of the font spec should be filled in with these values:
1622 * Courier New:Regular:10::Western */
1624 mswindows_font_instance_truename (Lisp_Font_Instance *f, Error_behavior errb)
1627 char *name = (char *) XSTRING_DATA (f->name);
1629 char* extname = (char*) alloca (strlen (name) + 19);
1630 strcpy (extname, name);
1632 while ((ptr = strchr (ptr, ':')) != 0)
1641 strcat (extname, ":Regular:10::Western");
1644 strcat (extname, ":10::Western");
1647 strcat (extname, "::Western");
1650 strcat (extname, ":Western");
1655 return build_ext_string (extname, Qnative);
1661 mswindows_font_spec_matches_charset (struct device *d, Lisp_Object charset,
1662 const Bufbyte *nonreloc, Lisp_Object reloc,
1663 Bytecount offset, Bytecount length)
1665 /* #### Implement me */
1666 if (UNBOUNDP (charset))
1672 /* find a font spec that matches font spec FONT and also matches
1673 (the registry of) CHARSET. */
1675 mswindows_find_charset_font (Lisp_Object device, Lisp_Object font,
1676 Lisp_Object charset)
1678 /* #### Implement me */
1679 return build_string ("Courier New:Regular:10");
1685 /************************************************************************/
1687 /************************************************************************/
1689 DEFUN ("mswindows-color-list", Fmswindows_color_list, 0, 0, 0, /*
1690 Return a list of the colors available on mswindows devices.
1694 Lisp_Object result = Qnil;
1697 for (i=0; i<countof (mswindows_X_color_map); i++)
1698 result = Fcons (build_string (mswindows_X_color_map[i].name), result);
1700 return Fnreverse (result);
1705 /************************************************************************/
1706 /* initialization */
1707 /************************************************************************/
1710 syms_of_objects_mswindows (void)
1712 DEFSUBR (Fmswindows_color_list);
1716 console_type_create_objects_mswindows (void)
1718 /* object methods */
1719 CONSOLE_HAS_METHOD (mswindows, initialize_color_instance);
1720 /* CONSOLE_HAS_METHOD (mswindows, mark_color_instance); */
1721 CONSOLE_HAS_METHOD (mswindows, print_color_instance);
1722 CONSOLE_HAS_METHOD (mswindows, finalize_color_instance);
1723 CONSOLE_HAS_METHOD (mswindows, color_instance_equal);
1724 CONSOLE_HAS_METHOD (mswindows, color_instance_hash);
1725 CONSOLE_HAS_METHOD (mswindows, color_instance_rgb_components);
1726 CONSOLE_HAS_METHOD (mswindows, valid_color_name_p);
1728 CONSOLE_HAS_METHOD (mswindows, initialize_font_instance);
1729 /* CONSOLE_HAS_METHOD (mswindows, mark_font_instance); */
1730 CONSOLE_HAS_METHOD (mswindows, print_font_instance);
1731 CONSOLE_HAS_METHOD (mswindows, finalize_font_instance);
1732 CONSOLE_HAS_METHOD (mswindows, font_instance_truename);
1733 CONSOLE_HAS_METHOD (mswindows, list_fonts);
1735 CONSOLE_HAS_METHOD (mswindows, font_spec_matches_charset);
1736 CONSOLE_HAS_METHOD (mswindows, find_charset_font);
1739 /* Printer methods - delegate most to windows methods,
1740 since graphical objects behave the same way. */
1742 CONSOLE_INHERITS_METHOD (msprinter, mswindows, initialize_color_instance);
1743 /* CONSOLE_INHERITS_METHOD (msprinter, mswindows, mark_color_instance); */
1744 CONSOLE_INHERITS_METHOD (msprinter, mswindows, print_color_instance);
1745 CONSOLE_INHERITS_METHOD (msprinter, mswindows, finalize_color_instance);
1746 CONSOLE_INHERITS_METHOD (msprinter, mswindows, color_instance_equal);
1747 CONSOLE_INHERITS_METHOD (msprinter, mswindows, color_instance_hash);
1748 CONSOLE_INHERITS_METHOD (msprinter, mswindows, color_instance_rgb_components);
1749 CONSOLE_INHERITS_METHOD (msprinter, mswindows, valid_color_name_p);
1751 CONSOLE_HAS_METHOD (msprinter, initialize_font_instance);
1752 /* CONSOLE_INHERITS_METHOD (msprinter, mswindows, mark_font_instance); */
1753 CONSOLE_INHERITS_METHOD (msprinter, mswindows, print_font_instance);
1754 CONSOLE_INHERITS_METHOD (msprinter, mswindows, finalize_font_instance);
1755 CONSOLE_INHERITS_METHOD (msprinter, mswindows, font_instance_truename);
1756 CONSOLE_INHERITS_METHOD (msprinter, mswindows, list_fonts);
1758 CONSOLE_INHERITS_METHOD (msprinter, mswindows, font_spec_matches_charset);
1759 CONSOLE_INHERITS_METHOD (msprinter, mswindows, find_charset_font);
1764 vars_of_objects_mswindows (void)