Mercurial > hg > xemacs-beta
comparison src/objects-msw.c @ 428:3ecd8885ac67 r21-2-22
Import from CVS: tag r21-2-22
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:28:15 +0200 |
parents | |
children | a5df635868b2 |
comparison
equal
deleted
inserted
replaced
427:0a0253eac470 | 428:3ecd8885ac67 |
---|---|
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. | |
8 | |
9 This file is part of XEmacs. | |
10 | |
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 | |
14 later version. | |
15 | |
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 | |
19 for more details. | |
20 | |
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. */ | |
25 | |
26 /* Synched up with: Not in FSF. */ | |
27 | |
28 /* Authorship: | |
29 | |
30 Jamie Zawinski, Chuck Thompson, Ben Wing | |
31 Rewritten for mswindows by Jonathan Harris, November 1997 for 21.0. | |
32 */ | |
33 | |
34 | |
35 /* TODO: palette handling */ | |
36 | |
37 #include <config.h> | |
38 #include "lisp.h" | |
39 #include "hash.h" | |
40 | |
41 #include "console-msw.h" | |
42 #include "objects-msw.h" | |
43 | |
44 #ifdef MULE | |
45 #include "mule-charset.h" | |
46 #endif | |
47 | |
48 #include "buffer.h" | |
49 #include "device.h" | |
50 #include "insdel.h" | |
51 | |
52 #if defined(__CYGWIN32__) || defined(__MINGW32__) | |
53 #define stricmp strcasecmp | |
54 #define FONTENUMPROC FONTENUMEXPROC | |
55 #define ntmTm ntmentm | |
56 #endif | |
57 | |
58 typedef struct colormap_t | |
59 { | |
60 CONST char *name; | |
61 CONST COLORREF colorref; | |
62 } colormap_t; | |
63 | |
64 /* Colors from X11R6 "XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp" */ | |
65 static CONST colormap_t mswindows_X_color_map[] = | |
66 { | |
67 {"snow" , PALETTERGB (255, 250, 250) }, | |
68 {"GhostWhite" , PALETTERGB (248, 248, 255) }, | |
69 {"WhiteSmoke" , PALETTERGB (245, 245, 245) }, | |
70 {"gainsboro" , PALETTERGB (220, 220, 220) }, | |
71 {"FloralWhite" , PALETTERGB (255, 250, 240) }, | |
72 {"OldLace" , PALETTERGB (253, 245, 230) }, | |
73 {"linen" , PALETTERGB (250, 240, 230) }, | |
74 {"AntiqueWhite" , PALETTERGB (250, 235, 215) }, | |
75 {"PapayaWhip" , PALETTERGB (255, 239, 213) }, | |
76 {"BlanchedAlmond" , PALETTERGB (255, 235, 205) }, | |
77 {"bisque" , PALETTERGB (255, 228, 196) }, | |
78 {"PeachPuff" , PALETTERGB (255, 218, 185) }, | |
79 {"NavajoWhite" , PALETTERGB (255, 222, 173) }, | |
80 {"moccasin" , PALETTERGB (255, 228, 181) }, | |
81 {"cornsilk" , PALETTERGB (255, 248, 220) }, | |
82 {"ivory" , PALETTERGB (255, 255, 240) }, | |
83 {"LemonChiffon" , PALETTERGB (255, 250, 205) }, | |
84 {"seashell" , PALETTERGB (255, 245, 238) }, | |
85 {"honeydew" , PALETTERGB (240, 255, 240) }, | |
86 {"MintCream" , PALETTERGB (245, 255, 250) }, | |
87 {"azure" , PALETTERGB (240, 255, 255) }, | |
88 {"AliceBlue" , PALETTERGB (240, 248, 255) }, | |
89 {"lavender" , PALETTERGB (230, 230, 250) }, | |
90 {"LavenderBlush" , PALETTERGB (255, 240, 245) }, | |
91 {"MistyRose" , PALETTERGB (255, 228, 225) }, | |
92 {"white" , PALETTERGB (255, 255, 255) }, | |
93 {"black" , PALETTERGB (0, 0, 0) }, | |
94 {"DarkSlateGray" , PALETTERGB (47, 79, 79) }, | |
95 {"DarkSlateGrey" , PALETTERGB (47, 79, 79) }, | |
96 {"DimGray" , PALETTERGB (105, 105, 105) }, | |
97 {"DimGrey" , PALETTERGB (105, 105, 105) }, | |
98 {"SlateGray" , PALETTERGB (112, 128, 144) }, | |
99 {"SlateGrey" , PALETTERGB (112, 128, 144) }, | |
100 {"LightSlateGray" , PALETTERGB (119, 136, 153) }, | |
101 {"LightSlateGrey" , PALETTERGB (119, 136, 153) }, | |
102 {"gray" , PALETTERGB (190, 190, 190) }, | |
103 {"grey" , PALETTERGB (190, 190, 190) }, | |
104 {"LightGrey" , PALETTERGB (211, 211, 211) }, | |
105 {"LightGray" , PALETTERGB (211, 211, 211) }, | |
106 {"MidnightBlue" , PALETTERGB (25, 25, 112) }, | |
107 {"navy" , PALETTERGB (0, 0, 128) }, | |
108 {"NavyBlue" , PALETTERGB (0, 0, 128) }, | |
109 {"CornflowerBlue" , PALETTERGB (100, 149, 237) }, | |
110 {"DarkSlateBlue" , PALETTERGB (72, 61, 139) }, | |
111 {"SlateBlue" , PALETTERGB (106, 90, 205) }, | |
112 {"MediumSlateBlue" , PALETTERGB (123, 104, 238) }, | |
113 {"LightSlateBlue" , PALETTERGB (132, 112, 255) }, | |
114 {"MediumBlue" , PALETTERGB (0, 0, 205) }, | |
115 {"RoyalBlue" , PALETTERGB (65, 105, 225) }, | |
116 {"blue" , PALETTERGB (0, 0, 255) }, | |
117 {"DodgerBlue" , PALETTERGB (30, 144, 255) }, | |
118 {"DeepSkyBlue" , PALETTERGB (0, 191, 255) }, | |
119 {"SkyBlue" , PALETTERGB (135, 206, 235) }, | |
120 {"LightSkyBlue" , PALETTERGB (135, 206, 250) }, | |
121 {"SteelBlue" , PALETTERGB (70, 130, 180) }, | |
122 {"LightSteelBlue" , PALETTERGB (176, 196, 222) }, | |
123 {"LightBlue" , PALETTERGB (173, 216, 230) }, | |
124 {"PowderBlue" , PALETTERGB (176, 224, 230) }, | |
125 {"PaleTurquoise" , PALETTERGB (175, 238, 238) }, | |
126 {"DarkTurquoise" , PALETTERGB (0, 206, 209) }, | |
127 {"MediumTurquoise" , PALETTERGB (72, 209, 204) }, | |
128 {"turquoise" , PALETTERGB (64, 224, 208) }, | |
129 {"cyan" , PALETTERGB (0, 255, 255) }, | |
130 {"LightCyan" , PALETTERGB (224, 255, 255) }, | |
131 {"CadetBlue" , PALETTERGB (95, 158, 160) }, | |
132 {"MediumAquamarine" , PALETTERGB (102, 205, 170) }, | |
133 {"aquamarine" , PALETTERGB (127, 255, 212) }, | |
134 {"DarkGreen" , PALETTERGB (0, 100, 0) }, | |
135 {"DarkOliveGreen" , PALETTERGB (85, 107, 47) }, | |
136 {"DarkSeaGreen" , PALETTERGB (143, 188, 143) }, | |
137 {"SeaGreen" , PALETTERGB (46, 139, 87) }, | |
138 {"MediumSeaGreen" , PALETTERGB (60, 179, 113) }, | |
139 {"LightSeaGreen" , PALETTERGB (32, 178, 170) }, | |
140 {"PaleGreen" , PALETTERGB (152, 251, 152) }, | |
141 {"SpringGreen" , PALETTERGB (0, 255, 127) }, | |
142 {"LawnGreen" , PALETTERGB (124, 252, 0) }, | |
143 {"green" , PALETTERGB (0, 255, 0) }, | |
144 {"chartreuse" , PALETTERGB (127, 255, 0) }, | |
145 {"MediumSpringGreen" , PALETTERGB (0, 250, 154) }, | |
146 {"GreenYellow" , PALETTERGB (173, 255, 47) }, | |
147 {"LimeGreen" , PALETTERGB (50, 205, 50) }, | |
148 {"YellowGreen" , PALETTERGB (154, 205, 50) }, | |
149 {"ForestGreen" , PALETTERGB (34, 139, 34) }, | |
150 {"OliveDrab" , PALETTERGB (107, 142, 35) }, | |
151 {"DarkKhaki" , PALETTERGB (189, 183, 107) }, | |
152 {"khaki" , PALETTERGB (240, 230, 140) }, | |
153 {"PaleGoldenrod" , PALETTERGB (238, 232, 170) }, | |
154 {"LightGoldenrodYellow" , PALETTERGB (250, 250, 210) }, | |
155 {"LightYellow" , PALETTERGB (255, 255, 224) }, | |
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 (238, 238, 224) }, | |
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 (142, 229, 238) }, | |
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 (127, 127, 127) }, | |
616 {"grey50" , PALETTERGB (127, 127, 127) }, | |
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 (191, 191, 191) }, | |
666 {"grey75" , PALETTERGB (191, 191, 191) }, | |
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, 139) }, | |
720 {"DarkCyan" , PALETTERGB (0, 139, 139) }, | |
721 {"DarkMagenta" , PALETTERGB (139, 0, 139) }, | |
722 {"DarkRed" , PALETTERGB (139, 0, 0) }, | |
723 {"LightGreen" , PALETTERGB (144, 238, 144) } | |
724 }; | |
725 | |
726 | |
727 typedef struct fontmap_t | |
728 { | |
729 CONST char *name; | |
730 CONST int value; | |
731 } fontmap_t; | |
732 | |
733 /* Default weight first, preferred names listed before synonyms */ | |
734 static CONST fontmap_t fontweight_map[] = | |
735 { | |
736 {"Regular" , FW_REGULAR}, /* The standard font weight */ | |
737 {"Thin" , FW_THIN}, | |
738 {"Extra Light" , FW_EXTRALIGHT}, | |
739 {"Ultra Light" , FW_ULTRALIGHT}, | |
740 {"Light" , FW_LIGHT}, | |
741 {"Normal" , FW_NORMAL}, | |
742 {"Medium" , FW_MEDIUM}, | |
743 {"Semi Bold" , FW_SEMIBOLD}, | |
744 {"Demi Bold" , FW_DEMIBOLD}, | |
745 {"Bold" , FW_BOLD}, /* The standard bold font weight */ | |
746 {"Extra Bold" , FW_EXTRABOLD}, | |
747 {"Ultra Bold" , FW_ULTRABOLD}, | |
748 {"Heavy" , FW_HEAVY}, | |
749 {"Black" , FW_BLACK} | |
750 }; | |
751 | |
752 /* Default charset first, no synonyms allowed because these names are | |
753 * matched against the names reported by win32 by match_font() */ | |
754 static CONST fontmap_t charset_map[] = | |
755 { | |
756 {"Western" , ANSI_CHARSET}, | |
757 {"Symbol" , SYMBOL_CHARSET}, | |
758 {"Shift JIS" , SHIFTJIS_CHARSET}, /* #### Name to be verified */ | |
759 {"GB2312" , GB2312_CHARSET}, /* #### Name to be verified */ | |
760 {"Hanguel" , HANGEUL_CHARSET}, | |
761 {"Chinese Big 5" , CHINESEBIG5_CHARSET}, /* #### Name to be verified */ | |
762 #if (WINVER >= 0x0400) | |
763 {"Johab" , JOHAB_CHARSET}, /* #### Name to be verified */ | |
764 {"Hebrew" , HEBREW_CHARSET}, /* #### Name to be verified */ | |
765 {"Arabic" , ARABIC_CHARSET}, /* #### Name to be verified */ | |
766 {"Greek" , GREEK_CHARSET}, | |
767 {"Turkish" , TURKISH_CHARSET}, | |
768 {"Vietnamese" , VIETNAMESE_CHARSET}, /* #### Name to be verified */ | |
769 {"Thai" , THAI_CHARSET}, /* #### Name to be verified */ | |
770 {"Central European" , EASTEUROPE_CHARSET}, | |
771 {"Cyrillic" , RUSSIAN_CHARSET}, | |
772 {"Mac" , MAC_CHARSET}, | |
773 {"Baltic" , BALTIC_CHARSET}, | |
774 #endif | |
775 {"OEM/DOS" , OEM_CHARSET} | |
776 }; | |
777 | |
778 | |
779 /************************************************************************/ | |
780 /* helpers */ | |
781 /************************************************************************/ | |
782 | |
783 static int | |
784 hexval (char c) | |
785 { | |
786 /* assumes ASCII and isxdigit(c) */ | |
787 if (c >= 'a') | |
788 return c-'a' + 10; | |
789 else if (c >= 'A') | |
790 return c-'A' + 10; | |
791 else | |
792 return c-'0'; | |
793 } | |
794 | |
795 COLORREF | |
796 mswindows_string_to_color(CONST char *name) | |
797 { | |
798 int i; | |
799 | |
800 if (*name == '#') | |
801 { | |
802 /* numeric names look like "#RRGGBB", "#RRRGGGBBB" or "#RRRRGGGGBBBB" | |
803 or "rgb:rrrr/gggg/bbbb" */ | |
804 unsigned int r, g, b; | |
805 | |
806 for (i=1; i<strlen(name); i++) | |
807 { | |
808 if (!isxdigit ((int)name[i])) | |
809 return (COLORREF) -1; | |
810 } | |
811 if (strlen(name)==7) | |
812 { | |
813 r = hexval (name[1]) * 16 + hexval (name[2]); | |
814 g = hexval (name[3]) * 16 + hexval (name[4]); | |
815 b = hexval (name[5]) * 16 + hexval (name[6]); | |
816 return (PALETTERGB (r, g, b)); | |
817 } | |
818 else if (strlen(name)==10) | |
819 { | |
820 r = hexval (name[1]) * 16 + hexval (name[2]); | |
821 g = hexval (name[4]) * 16 + hexval (name[5]); | |
822 b = hexval (name[7]) * 16 + hexval (name[8]); | |
823 return (PALETTERGB (r, g, b)); | |
824 } | |
825 else if (strlen(name)==13) | |
826 { | |
827 r = hexval (name[1]) * 16 + hexval (name[2]); | |
828 g = hexval (name[5]) * 16 + hexval (name[6]); | |
829 b = hexval (name[9]) * 16 + hexval (name[10]); | |
830 return (PALETTERGB (r, g, b)); | |
831 } | |
832 } | |
833 else if (!strncmp(name, "rgb:", 4)) | |
834 { | |
835 unsigned int r,g,b; | |
836 | |
837 if (sscanf(name, "rgb:%04x/%04x/%04x", &r, &g, &b) == 3) | |
838 { | |
839 int len = strlen (name); | |
840 if (len == 18) | |
841 { | |
842 r /= 257; | |
843 g /= 257; | |
844 b /= 257; | |
845 } | |
846 else if (len == 15) | |
847 { | |
848 r /= 17; | |
849 g /= 17; | |
850 b /= 17; | |
851 } | |
852 return (PALETTERGB (r, g, b)); | |
853 } | |
854 else | |
855 return (COLORREF) -1; | |
856 } | |
857 else if (*name) /* Can't be an empty string */ | |
858 { | |
859 char *nospaces = alloca (strlen (name)+1); | |
860 char *c=nospaces; | |
861 while (*name) | |
862 if (*name != ' ') | |
863 *(c++) = *(name++); | |
864 else | |
865 name++; | |
866 *c = '\0'; | |
867 | |
868 for (i=0; i< countof (mswindows_X_color_map); i++) | |
869 if (!stricmp (nospaces, mswindows_X_color_map[i].name)) | |
870 return (mswindows_X_color_map[i].colorref); | |
871 } | |
872 return (COLORREF) -1; | |
873 } | |
874 | |
875 /* | |
876 * Returns non-zero if the two supplied font patterns match. | |
877 * If they match and fontname is not NULL, copies the logical OR of the | |
878 * patterns to fontname (which is assumed to be at least MSW_FONTSIZE in size). | |
879 * | |
880 * The patterns 'match' iff for each field that is not blank in either pattern, | |
881 * the corresponding field in the other pattern is either identical or blank. | |
882 */ | |
883 static int | |
884 match_font (char *pattern1, char *pattern2, char *fontname) | |
885 { | |
886 char *c1=pattern1, *c2=pattern2, *e1=0, *e2=0; | |
887 int i; | |
888 | |
889 if (fontname) | |
890 fontname[0] = '\0'; | |
891 | |
892 for (i=0; i<5; i++) | |
893 { | |
894 if (c1 && (e1 = strchr (c1, ':'))) | |
895 *(e1) = '\0'; | |
896 if (c2 && (e2 = strchr (c2, ':'))) | |
897 *(e2) = '\0'; | |
898 | |
899 if (c1 && c1[0]!='\0') | |
900 { | |
901 if (c2 && c2[0]!='\0' && stricmp(c1, c2)) | |
902 { | |
903 if (e1) *e1 = ':'; | |
904 if (e2) *e2 = ':'; | |
905 return 0; | |
906 } | |
907 else if (fontname) | |
908 strcat (strcat (fontname, c1), ":"); | |
909 } | |
910 else if (fontname) | |
911 { | |
912 if (c2 && c2[0]!='\0') | |
913 strcat (strcat (fontname, c2), ":"); | |
914 else | |
915 strcat (fontname, ":"); | |
916 } | |
917 | |
918 if (e1) *(e1++) = ':'; | |
919 if (e2) *(e2++) = ':'; | |
920 c1=e1; | |
921 c2=e2; | |
922 } | |
923 | |
924 if (fontname) | |
925 fontname[strlen (fontname) - 1] = '\0'; /* Trim trailing ':' */ | |
926 return 1; | |
927 } | |
928 | |
929 | |
930 | |
931 | |
932 | |
933 /************************************************************************/ | |
934 /* exports */ | |
935 /************************************************************************/ | |
936 | |
937 struct font_enum_t | |
938 { | |
939 HDC hdc; | |
940 struct device *d; | |
941 }; | |
942 | |
943 static int CALLBACK | |
944 font_enum_callback_2 (ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *lpntme, | |
945 int FontType, struct font_enum_t *font_enum) | |
946 { | |
947 struct mswindows_font_enum *fontlist, **fonthead; | |
948 char fontname[MSW_FONTSIZE]; | |
949 int i; | |
950 | |
951 /* | |
952 * The enumerated font weights are not to be trusted because: | |
953 * a) lpelfe->elfStyle is only filled in for TrueType fonts. | |
954 * b) Not all Bold and Italic styles of all fonts (inluding some Vector, | |
955 * Truetype and Raster fonts) are enumerated. | |
956 * I guess that fonts for which Bold and Italic styles are generated | |
957 * 'on-the-fly' are not enumerated. It would be overly restrictive to | |
958 * disallow Bold And Italic weights for these fonts, so we just leave | |
959 * weights unspecified. This means that we have to weed out duplicates of | |
960 * those fonts that do get enumerated with different weights. | |
961 */ | |
962 if (FontType == 0 /*vector*/ || FontType == TRUETYPE_FONTTYPE) | |
963 /* Scalable, so leave pointsize blank */ | |
964 sprintf (fontname, "%s::::", lpelfe->elfLogFont.lfFaceName); | |
965 else | |
966 /* Formula for pointsize->height from LOGFONT docs in Platform SDK */ | |
967 sprintf (fontname, "%s::%d::", lpelfe->elfLogFont.lfFaceName, | |
968 MulDiv (lpntme->ntmTm.tmHeight - lpntme->ntmTm.tmInternalLeading, | |
969 72, DEVICE_MSWINDOWS_LOGPIXELSY (font_enum->d))); | |
970 | |
971 /* | |
972 * The enumerated font character set strings are not to be trusted because | |
973 * lpelfe->elfScript is returned in the host language and not in English. | |
974 * We can't know a priori the translations of "Western", "Central European" | |
975 * etc into the host language, so we must use English. The same argument | |
976 * applies to the font weight string when matching fonts. | |
977 */ | |
978 for (i=0; i<countof (charset_map); i++) | |
979 if (lpelfe->elfLogFont.lfCharSet == charset_map[i].value) | |
980 { | |
981 strcat (fontname, charset_map[i].name); | |
982 break; | |
983 } | |
984 if (i==countof (charset_map)) | |
985 strcpy (fontname, charset_map[0].name); | |
986 | |
987 /* Check that the new font is not a duplicate */ | |
988 fonthead = &DEVICE_MSWINDOWS_FONTLIST (font_enum->d); | |
989 fontlist = *fonthead; | |
990 while (fontlist) | |
991 if (!strcmp (fontname, fontlist->fontname)) | |
992 return 1; /* found a duplicate */ | |
993 else | |
994 fontlist = fontlist->next; | |
995 | |
996 /* Insert entry at head */ | |
997 fontlist = *fonthead; | |
998 *fonthead = xmalloc (sizeof (struct mswindows_font_enum)); | |
999 if (*fonthead == NULL) | |
1000 { | |
1001 *fonthead = fontlist; | |
1002 return 0; | |
1003 } | |
1004 strcpy ((*fonthead)->fontname, fontname); | |
1005 (*fonthead)->next = fontlist; | |
1006 return 1; | |
1007 } | |
1008 | |
1009 static int CALLBACK | |
1010 font_enum_callback_1 (ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *lpntme, | |
1011 int FontType, struct font_enum_t *font_enum) | |
1012 { | |
1013 /* This function gets called once per facename per character set. | |
1014 * We call a second callback to enumerate the fonts in each facename */ | |
1015 return EnumFontFamiliesEx (font_enum->hdc, &lpelfe->elfLogFont, | |
1016 (FONTENUMPROC) font_enum_callback_2, | |
1017 (LPARAM) font_enum, 0); | |
1018 } | |
1019 | |
1020 /* | |
1021 * Enumerate the available fonts. Called by mswindows_init_device(). | |
1022 * Fills in the device's device-type-specfic fontlist. | |
1023 */ | |
1024 void | |
1025 mswindows_enumerate_fonts (struct device *d) | |
1026 { | |
1027 HDC hdc = CreateCompatibleDC (NULL); | |
1028 LOGFONT logfont; | |
1029 struct font_enum_t font_enum; | |
1030 | |
1031 assert (hdc!=NULL); | |
1032 logfont.lfCharSet = DEFAULT_CHARSET; | |
1033 logfont.lfFaceName[0] = '\0'; | |
1034 logfont.lfPitchAndFamily = DEFAULT_PITCH; | |
1035 font_enum.hdc = hdc; | |
1036 font_enum.d = d; | |
1037 DEVICE_MSWINDOWS_FONTLIST (d) = NULL; | |
1038 EnumFontFamiliesEx (hdc, &logfont, (FONTENUMPROC) font_enum_callback_1, | |
1039 (LPARAM) (&font_enum), 0); | |
1040 DeleteDC (hdc); | |
1041 } | |
1042 | |
1043 | |
1044 /************************************************************************/ | |
1045 /* methods */ | |
1046 /************************************************************************/ | |
1047 | |
1048 static int | |
1049 mswindows_initialize_color_instance (struct Lisp_Color_Instance *c, Lisp_Object name, | |
1050 Lisp_Object device, Error_behavior errb) | |
1051 { | |
1052 CONST char *extname; | |
1053 COLORREF color; | |
1054 | |
1055 GET_C_STRING_CTEXT_DATA_ALLOCA (name, extname); | |
1056 color = mswindows_string_to_color(extname); | |
1057 if (color != -1) | |
1058 { | |
1059 c->data = xnew (struct mswindows_color_instance_data); | |
1060 COLOR_INSTANCE_MSWINDOWS_COLOR (c) = color; | |
1061 return 1; | |
1062 } | |
1063 maybe_signal_simple_error ("Unrecognized color", name, Qcolor, errb); | |
1064 return(0); | |
1065 } | |
1066 | |
1067 #if 0 | |
1068 static void | |
1069 mswindows_mark_color_instance (struct Lisp_Color_Instance *c) | |
1070 { | |
1071 } | |
1072 #endif | |
1073 | |
1074 static void | |
1075 mswindows_print_color_instance (struct Lisp_Color_Instance *c, | |
1076 Lisp_Object printcharfun, | |
1077 int escapeflag) | |
1078 { | |
1079 char buf[32]; | |
1080 COLORREF color = COLOR_INSTANCE_MSWINDOWS_COLOR (c); | |
1081 sprintf (buf, " %06ld=(%04X,%04X,%04X)", color & 0xffffff, | |
1082 GetRValue(color)*257, GetGValue(color)*257, GetBValue(color)*257); | |
1083 write_c_string (buf, printcharfun); | |
1084 } | |
1085 | |
1086 static void | |
1087 mswindows_finalize_color_instance (struct Lisp_Color_Instance *c) | |
1088 { | |
1089 if (c->data) | |
1090 { | |
1091 xfree (c->data); | |
1092 c->data = 0; | |
1093 } | |
1094 } | |
1095 | |
1096 static int | |
1097 mswindows_color_instance_equal (struct Lisp_Color_Instance *c1, | |
1098 struct Lisp_Color_Instance *c2, | |
1099 int depth) | |
1100 { | |
1101 return (COLOR_INSTANCE_MSWINDOWS_COLOR(c1) == COLOR_INSTANCE_MSWINDOWS_COLOR(c2)); | |
1102 } | |
1103 | |
1104 static unsigned long | |
1105 mswindows_color_instance_hash (struct Lisp_Color_Instance *c, int depth) | |
1106 { | |
1107 return (unsigned long) COLOR_INSTANCE_MSWINDOWS_COLOR(c); | |
1108 } | |
1109 | |
1110 static Lisp_Object | |
1111 mswindows_color_instance_rgb_components (struct Lisp_Color_Instance *c) | |
1112 { | |
1113 COLORREF color = COLOR_INSTANCE_MSWINDOWS_COLOR (c); | |
1114 return list3 (make_int (GetRValue (color) * 257), | |
1115 make_int (GetGValue (color) * 257), | |
1116 make_int (GetBValue (color) * 257)); | |
1117 } | |
1118 | |
1119 static int | |
1120 mswindows_valid_color_name_p (struct device *d, Lisp_Object color) | |
1121 { | |
1122 CONST char *extname; | |
1123 | |
1124 GET_C_STRING_CTEXT_DATA_ALLOCA (color, extname); | |
1125 return (mswindows_string_to_color(extname)!=-1); | |
1126 } | |
1127 | |
1128 | |
1129 | |
1130 static void | |
1131 mswindows_finalize_font_instance (struct Lisp_Font_Instance *f) | |
1132 { | |
1133 if (f->data) | |
1134 { | |
1135 DeleteObject(f->data); | |
1136 f->data=0; | |
1137 } | |
1138 } | |
1139 | |
1140 | |
1141 static int | |
1142 mswindows_initialize_font_instance (struct Lisp_Font_Instance *f, Lisp_Object name, | |
1143 Lisp_Object device, Error_behavior errb) | |
1144 { | |
1145 CONST char *extname; | |
1146 LOGFONT logfont; | |
1147 int fields, i; | |
1148 int pt; | |
1149 char fontname[LF_FACESIZE], weight[LF_FACESIZE], *style, points[8]; | |
1150 char effects[LF_FACESIZE], charset[LF_FACESIZE]; | |
1151 char *c; | |
1152 HDC hdc; | |
1153 HFONT holdfont; | |
1154 TEXTMETRIC metrics; | |
1155 | |
1156 extname = XSTRING_DATA (name); | |
1157 | |
1158 /* | |
1159 * mswindows fonts look like: | |
1160 * fontname[:[weight ][style][:pointsize[:effects]]][:charset] | |
1161 * The font name field shouldn't be empty. | |
1162 * | |
1163 * ie: | |
1164 * Lucida Console:Regular:10 | |
1165 * minimal: | |
1166 * Courier New | |
1167 * maximal: | |
1168 * Courier New:Bold Italic:10:underline strikeout:western | |
1169 */ | |
1170 | |
1171 fields = sscanf (extname, "%31[^:]:%31[^:]:%7[^:]:%31[^:]:%31s", | |
1172 fontname, weight, points, effects, charset); | |
1173 | |
1174 /* This function is implemented in a fairly ad-hoc manner. | |
1175 * The general idea is to validate and canonicalize each of the above fields | |
1176 * at the same time as we build up the win32 LOGFONT structure. This enables | |
1177 * us to use match_font() on a canonicalized font string to check the | |
1178 * availability of the requested font */ | |
1179 | |
1180 if (fields < 0) | |
1181 { | |
1182 maybe_signal_simple_error ("Invalid font", name, Qfont, errb); | |
1183 return (0); | |
1184 } | |
1185 | |
1186 if (fields>0 && strlen(fontname)) | |
1187 { | |
1188 strncpy (logfont.lfFaceName, fontname, LF_FACESIZE); | |
1189 logfont.lfFaceName[LF_FACESIZE-1] = 0; | |
1190 } | |
1191 else | |
1192 { | |
1193 maybe_signal_simple_error ("Must specify a font name", name, Qfont, errb); | |
1194 return (0); | |
1195 } | |
1196 | |
1197 /* weight */ | |
1198 if (fields < 2) | |
1199 strcpy (weight, fontweight_map[0].name); | |
1200 | |
1201 /* Maybe split weight into weight and style */ | |
1202 if ((c=strchr(weight, ' '))) | |
1203 { | |
1204 *c = '\0'; | |
1205 style = c+1; | |
1206 } | |
1207 else | |
1208 style = NULL; | |
1209 | |
1210 for (i=0; i<countof (fontweight_map); i++) | |
1211 if (!stricmp (weight, fontweight_map[i].name)) | |
1212 { | |
1213 logfont.lfWeight = fontweight_map[i].value; | |
1214 break; | |
1215 } | |
1216 if (i == countof (fontweight_map)) /* No matching weight */ | |
1217 { | |
1218 if (!style) | |
1219 { | |
1220 logfont.lfWeight = FW_REGULAR; | |
1221 style = weight; /* May have specified style without weight */ | |
1222 } | |
1223 else | |
1224 { | |
1225 maybe_signal_simple_error ("Invalid font weight", name, Qfont, errb); | |
1226 return (0); | |
1227 } | |
1228 } | |
1229 | |
1230 if (style) | |
1231 { | |
1232 /* #### what about oblique? */ | |
1233 if (stricmp (style,"italic") == 0) | |
1234 logfont.lfItalic = TRUE; | |
1235 else | |
1236 { | |
1237 maybe_signal_simple_error ("Invalid font weight or style", name, Qfont, errb); | |
1238 return (0); | |
1239 } | |
1240 | |
1241 /* Glue weight and style together again */ | |
1242 if (weight != style) | |
1243 *c = ' '; | |
1244 } | |
1245 else | |
1246 logfont.lfItalic = FALSE; | |
1247 | |
1248 if (fields < 3) | |
1249 pt = 10; /* #### Should we reject strings that don't specify a size? */ | |
1250 else if ((pt=atoi(points)) == 0) | |
1251 { | |
1252 maybe_signal_simple_error ("Invalid font pointsize", name, Qfont, errb); | |
1253 return (0); | |
1254 } | |
1255 | |
1256 /* Formula for pointsize->height from LOGFONT docs in MSVC5 Platform SDK */ | |
1257 logfont.lfHeight = -MulDiv(pt, DEVICE_MSWINDOWS_LOGPIXELSY (XDEVICE (device)), 72); | |
1258 logfont.lfWidth = 0; | |
1259 | |
1260 /* Effects */ | |
1261 logfont.lfUnderline = FALSE; | |
1262 logfont.lfStrikeOut = FALSE; | |
1263 if (fields >= 4 && effects[0] != '\0') | |
1264 { | |
1265 char *effects2; | |
1266 | |
1267 /* Maybe split effects into effects and effects2 */ | |
1268 if ((c=strchr (effects, ' '))) | |
1269 { | |
1270 *c = '\0'; | |
1271 effects2 = c+1; | |
1272 } | |
1273 else | |
1274 effects2 = NULL; | |
1275 | |
1276 if (stricmp (effects, "underline") == 0) | |
1277 logfont.lfUnderline = TRUE; | |
1278 else if (stricmp (effects, "strikeout") == 0) | |
1279 logfont.lfStrikeOut = TRUE; | |
1280 else | |
1281 { | |
1282 maybe_signal_simple_error ("Invalid font effect", name, Qfont, errb); | |
1283 return (0); | |
1284 } | |
1285 | |
1286 if (effects2 && effects2[0] != '\0') | |
1287 { | |
1288 if (stricmp (effects2, "underline") == 0) | |
1289 logfont.lfUnderline = TRUE; | |
1290 else if (stricmp (effects2, "strikeout") == 0) | |
1291 logfont.lfStrikeOut = TRUE; | |
1292 else | |
1293 { | |
1294 maybe_signal_simple_error ("Invalid font effect", name, | |
1295 Qfont, errb); | |
1296 return (0); | |
1297 } | |
1298 } | |
1299 | |
1300 /* Regenerate sanitised effects string */ | |
1301 if (logfont.lfUnderline) | |
1302 { | |
1303 if (logfont.lfStrikeOut) | |
1304 strcpy (effects, "underline strikeout"); | |
1305 else | |
1306 strcpy (effects, "underline"); | |
1307 } | |
1308 else if (logfont.lfStrikeOut) | |
1309 strcpy (effects, "strikeout"); | |
1310 } | |
1311 else | |
1312 effects[0] = '\0'; | |
1313 | |
1314 /* Charset */ | |
1315 /* charset can be specified even if earlier fields havn't been */ | |
1316 if (fields < 5) | |
1317 { | |
1318 if ((c=strchr (extname, ':')) && (c=strchr (c+1, ':')) && | |
1319 (c=strchr (c+1, ':')) && (c=strchr (c+1, ':'))) | |
1320 { | |
1321 strncpy (charset, c+1, LF_FACESIZE); | |
1322 charset[LF_FACESIZE-1] = '\0'; | |
1323 } | |
1324 else | |
1325 strcpy (charset, charset_map[0].name); | |
1326 } | |
1327 | |
1328 for (i=0; i<countof (charset_map); i++) | |
1329 if (!stricmp (charset, charset_map[i].name)) | |
1330 { | |
1331 logfont.lfCharSet = charset_map[i].value; | |
1332 break; | |
1333 } | |
1334 | |
1335 if (i == countof (charset_map)) /* No matching charset */ | |
1336 { | |
1337 maybe_signal_simple_error ("Invalid charset", name, Qfont, errb); | |
1338 return 0; | |
1339 } | |
1340 | |
1341 /* Misc crud */ | |
1342 logfont.lfEscapement = logfont.lfOrientation = 0; | |
1343 #if 1 | |
1344 logfont.lfOutPrecision = OUT_DEFAULT_PRECIS; | |
1345 logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS; | |
1346 logfont.lfQuality = DEFAULT_QUALITY; | |
1347 #else | |
1348 logfont.lfOutPrecision = OUT_STROKE_PRECIS; | |
1349 logfont.lfClipPrecision = CLIP_STROKE_PRECIS; | |
1350 logfont.lfQuality = PROOF_QUALITY; | |
1351 #endif | |
1352 /* Default to monospaced if the specified fontname doesn't exist. */ | |
1353 logfont.lfPitchAndFamily = FF_MODERN; | |
1354 | |
1355 /* Windows will silently substitute a default font if the fontname | |
1356 * specifies a non-existent font. So we check the font against the device's | |
1357 * list of font patterns to make sure that at least one of them matches. */ | |
1358 { | |
1359 struct mswindows_font_enum *fontlist; | |
1360 char truename[MSW_FONTSIZE]; | |
1361 int done = 0; | |
1362 | |
1363 sprintf (truename, "%s:%s:%d:%s:%s", fontname, weight, pt, effects, charset); | |
1364 fontlist = DEVICE_MSWINDOWS_FONTLIST (XDEVICE (device)); | |
1365 while (fontlist && !done) | |
1366 { | |
1367 done = match_font (fontlist->fontname, truename, NULL); | |
1368 fontlist = fontlist->next; | |
1369 } | |
1370 if (!done) | |
1371 { | |
1372 maybe_signal_simple_error ("No matching font", name, Qfont, errb); | |
1373 return 0; | |
1374 } | |
1375 } | |
1376 | |
1377 if ((f->data = CreateFontIndirect(&logfont)) == NULL) | |
1378 { | |
1379 maybe_signal_simple_error ("Couldn't create font", name, Qfont, errb); | |
1380 return 0; | |
1381 } | |
1382 | |
1383 hdc = CreateCompatibleDC (NULL); | |
1384 if (hdc) | |
1385 { | |
1386 holdfont = SelectObject(hdc, f->data); | |
1387 if (holdfont) | |
1388 { | |
1389 GetTextMetrics (hdc, &metrics); | |
1390 SelectObject(hdc, holdfont); | |
1391 DeleteDC (hdc); | |
1392 f->width = (unsigned short) metrics.tmAveCharWidth; | |
1393 f->height = (unsigned short) metrics.tmHeight; | |
1394 f->ascent = (unsigned short) metrics.tmAscent; | |
1395 f->descent = (unsigned short) metrics.tmDescent; | |
1396 f->proportional_p = (metrics.tmPitchAndFamily & TMPF_FIXED_PITCH); | |
1397 return 1; | |
1398 } | |
1399 DeleteDC (hdc); | |
1400 } | |
1401 mswindows_finalize_font_instance (f); | |
1402 maybe_signal_simple_error ("Couldn't map font", name, Qfont, errb); | |
1403 return 0; | |
1404 } | |
1405 | |
1406 #if 0 | |
1407 static void | |
1408 mswindows_mark_font_instance (struct Lisp_Font_Instance *f) | |
1409 { | |
1410 } | |
1411 #endif | |
1412 | |
1413 static void | |
1414 mswindows_print_font_instance (struct Lisp_Font_Instance *f, | |
1415 Lisp_Object printcharfun, | |
1416 int escapeflag) | |
1417 { | |
1418 } | |
1419 | |
1420 static Lisp_Object | |
1421 mswindows_list_fonts (Lisp_Object pattern, Lisp_Object device) | |
1422 { | |
1423 Lisp_Object result = Qnil; | |
1424 struct mswindows_font_enum *fontlist; | |
1425 char fontname[MSW_FONTSIZE], *extpattern; | |
1426 | |
1427 GET_C_STRING_CTEXT_DATA_ALLOCA (pattern, extpattern); | |
1428 fontlist = DEVICE_MSWINDOWS_FONTLIST (XDEVICE (device)); | |
1429 while (fontlist) | |
1430 { | |
1431 if (match_font (fontlist->fontname, extpattern, fontname)) | |
1432 result = Fcons (build_string (fontname), result); | |
1433 fontlist = fontlist->next; | |
1434 } | |
1435 | |
1436 return Fnreverse (result); | |
1437 } | |
1438 | |
1439 /* Fill in missing parts of a font spec. This is primarily intended as a | |
1440 * helper function for the functions below. | |
1441 * mswindows fonts look like: | |
1442 * fontname[:[weight][ style][:pointsize[:effects]]][:charset] | |
1443 * A minimal mswindows font spec looks like: | |
1444 * Courier New | |
1445 * A maximal mswindows font spec looks like: | |
1446 * Courier New:Bold Italic:10:underline strikeout:Western | |
1447 * Missing parts of the font spec should be filled in with these values: | |
1448 * Courier New:Regular:10::Western */ | |
1449 static Lisp_Object | |
1450 mswindows_font_instance_truename (struct Lisp_Font_Instance *f, Error_behavior errb) | |
1451 { | |
1452 int nsep=0; | |
1453 char *name = (char *) XSTRING_DATA (f->name); | |
1454 char* ptr = name; | |
1455 char* extname = alloca (strlen (name) + 19); | |
1456 strcpy (extname, name); | |
1457 | |
1458 while ((ptr = strchr (ptr, ':')) != 0) | |
1459 { | |
1460 ptr++; | |
1461 nsep++; | |
1462 } | |
1463 | |
1464 switch (nsep) | |
1465 { | |
1466 case 0: | |
1467 strcat (extname, ":Regular:10::Western"); | |
1468 break; | |
1469 case 1: | |
1470 strcat (extname, ":10::Western"); | |
1471 break; | |
1472 case 2: | |
1473 strcat (extname, "::Western"); | |
1474 break; | |
1475 case 3: | |
1476 strcat (extname, ":Western"); | |
1477 break; | |
1478 default:; | |
1479 } | |
1480 | |
1481 return build_ext_string (extname, FORMAT_OS); | |
1482 } | |
1483 | |
1484 #ifdef MULE | |
1485 | |
1486 static int | |
1487 mswindows_font_spec_matches_charset (struct device *d, Lisp_Object charset, | |
1488 CONST Bufbyte *nonreloc, Lisp_Object reloc, | |
1489 Bytecount offset, Bytecount length) | |
1490 { | |
1491 /* #### Implement me */ | |
1492 if (UNBOUNDP (charset)) | |
1493 return 1; | |
1494 | |
1495 return 1; | |
1496 } | |
1497 | |
1498 /* find a font spec that matches font spec FONT and also matches | |
1499 (the registry of) CHARSET. */ | |
1500 static Lisp_Object | |
1501 mswindows_find_charset_font (Lisp_Object device, Lisp_Object font, | |
1502 Lisp_Object charset) | |
1503 { | |
1504 /* #### Implement me */ | |
1505 return build_string ("Courier New:Regular:10"); | |
1506 } | |
1507 | |
1508 #endif /* MULE */ | |
1509 | |
1510 | |
1511 /************************************************************************/ | |
1512 /* non-methods */ | |
1513 /************************************************************************/ | |
1514 | |
1515 DEFUN ("mswindows-color-list", Fmswindows_color_list, 0, 0, 0, /* | |
1516 Return a list of the colors available on mswindows devices. | |
1517 */ | |
1518 ()) | |
1519 { | |
1520 Lisp_Object result = Qnil; | |
1521 int i; | |
1522 | |
1523 for (i=0; i<countof (mswindows_X_color_map); i++) | |
1524 result = Fcons (build_string (mswindows_X_color_map[i].name), result); | |
1525 | |
1526 return Fnreverse (result); | |
1527 } | |
1528 | |
1529 | |
1530 | |
1531 /************************************************************************/ | |
1532 /* initialization */ | |
1533 /************************************************************************/ | |
1534 | |
1535 void | |
1536 syms_of_objects_mswindows (void) | |
1537 { | |
1538 DEFSUBR (Fmswindows_color_list); | |
1539 } | |
1540 | |
1541 void | |
1542 console_type_create_objects_mswindows (void) | |
1543 { | |
1544 /* object methods */ | |
1545 CONSOLE_HAS_METHOD (mswindows, initialize_color_instance); | |
1546 /* CONSOLE_HAS_METHOD (mswindows, mark_color_instance); */ | |
1547 CONSOLE_HAS_METHOD (mswindows, print_color_instance); | |
1548 CONSOLE_HAS_METHOD (mswindows, finalize_color_instance); | |
1549 CONSOLE_HAS_METHOD (mswindows, color_instance_equal); | |
1550 CONSOLE_HAS_METHOD (mswindows, color_instance_hash); | |
1551 CONSOLE_HAS_METHOD (mswindows, color_instance_rgb_components); | |
1552 CONSOLE_HAS_METHOD (mswindows, valid_color_name_p); | |
1553 | |
1554 CONSOLE_HAS_METHOD (mswindows, initialize_font_instance); | |
1555 /* CONSOLE_HAS_METHOD (mswindows, mark_font_instance); */ | |
1556 CONSOLE_HAS_METHOD (mswindows, print_font_instance); | |
1557 CONSOLE_HAS_METHOD (mswindows, finalize_font_instance); | |
1558 CONSOLE_HAS_METHOD (mswindows, font_instance_truename); | |
1559 CONSOLE_HAS_METHOD (mswindows, list_fonts); | |
1560 #ifdef MULE | |
1561 CONSOLE_HAS_METHOD (mswindows, font_spec_matches_charset); | |
1562 CONSOLE_HAS_METHOD (mswindows, find_charset_font); | |
1563 #endif | |
1564 } | |
1565 | |
1566 void | |
1567 vars_of_objects_mswindows (void) | |
1568 { | |
1569 } |