428
|
1 /* X-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.
|
2367
|
5 Copyright (C) 1995, 1996, 2000, 2001, 2002, 2004 Ben Wing.
|
428
|
6 Copyright (C) 1995 Sun Microsystems, Inc.
|
|
7
|
|
8 This file is part of XEmacs.
|
|
9
|
|
10 XEmacs is free software; you can redistribute it and/or modify it
|
|
11 under the terms of the GNU General Public License as published by the
|
|
12 Free Software Foundation; either version 2, or (at your option) any
|
|
13 later version.
|
|
14
|
|
15 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
17 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
18 for more details.
|
|
19
|
|
20 You should have received a copy of the GNU General Public License
|
|
21 along with XEmacs; see the file COPYING. If not, write to
|
|
22 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
23 Boston, MA 02111-1307, USA. */
|
|
24
|
|
25 /* Synched up with: Not in FSF. */
|
|
26
|
|
27 /* Authors: Jamie Zawinski, Chuck Thompson, Ben Wing */
|
|
28
|
442
|
29 /* This file Mule-ized by Ben Wing, 7-10-00. */
|
|
30
|
428
|
31 #include <config.h>
|
|
32 #include "lisp.h"
|
|
33
|
872
|
34 #include "charset.h"
|
|
35 #include "device-impl.h"
|
|
36 #include "insdel.h"
|
428
|
37
|
872
|
38 #include "console-x-impl.h"
|
|
39 #include "objects-x-impl.h"
|
428
|
40
|
|
41 int x_handle_non_fully_specified_fonts;
|
|
42
|
|
43
|
|
44 /************************************************************************/
|
|
45 /* color instances */
|
|
46 /************************************************************************/
|
|
47
|
|
48 /* Replacement for XAllocColor() that tries to return the nearest
|
|
49 available color if the colormap is full. Original was from FSFmacs,
|
|
50 but rewritten by Jareth Hein <jareth@camelot-soft.com> 97/11/25
|
|
51 Modified by Lee Kindness <lkindness@csl.co.uk> 31/08/99 to handle previous
|
|
52 total failure which was due to a read/write colorcell being the nearest
|
|
53 match - tries the next nearest...
|
|
54
|
|
55 Return value is 1 for normal success, 2 for nearest color success,
|
442
|
56 3 for Non-deallocable success. */
|
428
|
57 int
|
|
58 allocate_nearest_color (Display *display, Colormap colormap, Visual *visual,
|
|
59 XColor *color_def)
|
|
60 {
|
|
61 int status;
|
|
62
|
1204
|
63 if (visual->X_CLASSFIELD == DirectColor || visual->X_CLASSFIELD == TrueColor)
|
428
|
64 {
|
|
65 if (XAllocColor (display, colormap, color_def) != 0)
|
|
66 {
|
|
67 status = 1;
|
|
68 }
|
|
69 else
|
|
70 {
|
|
71 /* We're dealing with a TrueColor/DirectColor visual, so play games
|
|
72 with the RGB values in the XColor struct. */
|
440
|
73 /* #### JH: I'm not sure how a call to XAllocColor can fail in a
|
428
|
74 TrueColor or DirectColor visual, so I will just reformat the
|
|
75 request to match the requirements of the visual, and re-issue
|
|
76 the request. If this fails for anybody, I wanna know about it
|
|
77 so I can come up with a better plan */
|
|
78
|
|
79 unsigned long rshift,gshift,bshift,rbits,gbits,bbits,junk;
|
|
80 junk = visual->red_mask;
|
|
81 rshift = 0;
|
|
82 while ((junk & 0x1) == 0) {
|
|
83 junk = junk >> 1;
|
|
84 rshift ++;
|
|
85 }
|
|
86 rbits = 0;
|
|
87 while (junk != 0) {
|
|
88 junk = junk >> 1;
|
|
89 rbits++;
|
|
90 }
|
|
91 junk = visual->green_mask;
|
|
92 gshift = 0;
|
|
93 while ((junk & 0x1) == 0) {
|
|
94 junk = junk >> 1;
|
|
95 gshift ++;
|
|
96 }
|
|
97 gbits = 0;
|
|
98 while (junk != 0) {
|
|
99 junk = junk >> 1;
|
|
100 gbits++;
|
|
101 }
|
|
102 junk = visual->blue_mask;
|
|
103 bshift = 0;
|
|
104 while ((junk & 0x1) == 0) {
|
|
105 junk = junk >> 1;
|
|
106 bshift ++;
|
|
107 }
|
|
108 bbits = 0;
|
|
109 while (junk != 0) {
|
|
110 junk = junk >> 1;
|
|
111 bbits++;
|
|
112 }
|
|
113
|
|
114 color_def->red = color_def->red >> (16 - rbits);
|
|
115 color_def->green = color_def->green >> (16 - gbits);
|
|
116 color_def->blue = color_def->blue >> (16 - bbits);
|
|
117 if (XAllocColor (display, colormap, color_def) != 0)
|
|
118 status = 1;
|
|
119 else
|
|
120 {
|
|
121 int rd, gr, bl;
|
440
|
122 /* #### JH: I'm punting here, knowing that doing this will at
|
428
|
123 least draw the color correctly. However, unless we convert
|
|
124 all of the functions that allocate colors (graphics
|
|
125 libraries, etc) to use this function doing this is very
|
|
126 likely to cause problems later... */
|
|
127
|
|
128 if (rbits > 8)
|
|
129 rd = color_def->red << (rbits - 8);
|
|
130 else
|
|
131 rd = color_def->red >> (8 - rbits);
|
|
132 if (gbits > 8)
|
|
133 gr = color_def->green << (gbits - 8);
|
|
134 else
|
|
135 gr = color_def->green >> (8 - gbits);
|
|
136 if (bbits > 8)
|
|
137 bl = color_def->blue << (bbits - 8);
|
|
138 else
|
|
139 bl = color_def->blue >> (8 - bbits);
|
442
|
140 color_def->pixel = (rd << rshift) | (gr << gshift) | (bl <<
|
|
141 bshift);
|
428
|
142 status = 3;
|
|
143 }
|
|
144 }
|
|
145 }
|
|
146 else
|
|
147 {
|
|
148 XColor *cells = NULL;
|
|
149 /* JH: I can't believe there's no way to go backwards from a
|
|
150 colormap ID and get its visual and number of entries, but X
|
|
151 apparently isn't built that way... */
|
|
152 int no_cells = visual->map_entries;
|
|
153 status = 0;
|
|
154
|
|
155 if (XAllocColor (display, colormap, color_def) != 0)
|
|
156 status = 1;
|
|
157 else while( status != 2 )
|
|
158 {
|
|
159 /* If we got to this point, the colormap is full, so we're
|
|
160 going to try and get the next closest color. The algorithm used
|
|
161 is a least-squares matching, which is what X uses for closest
|
|
162 color matching with StaticColor visuals. */
|
|
163 int nearest;
|
|
164 long nearest_delta, trial_delta;
|
|
165 int x;
|
|
166
|
|
167 if( cells == NULL )
|
442
|
168 {
|
|
169 cells = alloca_array (XColor, no_cells);
|
|
170 for (x = 0; x < no_cells; x++)
|
|
171 cells[x].pixel = x;
|
428
|
172
|
442
|
173 /* read the current colormap */
|
|
174 XQueryColors (display, colormap, cells, no_cells);
|
|
175 }
|
428
|
176
|
|
177 nearest = 0;
|
|
178 /* I'm assuming CSE so I'm not going to condense this. */
|
|
179 nearest_delta = ((((color_def->red >> 8) - (cells[0].red >> 8))
|
|
180 * ((color_def->red >> 8) - (cells[0].red >> 8)))
|
|
181 +
|
|
182 (((color_def->green >> 8) - (cells[0].green >> 8))
|
442
|
183 * ((color_def->green >> 8) - (cells[0].green >>
|
|
184 8)))
|
428
|
185 +
|
|
186 (((color_def->blue >> 8) - (cells[0].blue >> 8))
|
442
|
187 * ((color_def->blue >> 8) - (cells[0].blue >>
|
|
188 8))));
|
428
|
189 for (x = 1; x < no_cells; x++)
|
|
190 {
|
|
191 trial_delta = ((((color_def->red >> 8) - (cells[x].red >> 8))
|
|
192 * ((color_def->red >> 8) - (cells[x].red >> 8)))
|
|
193 +
|
|
194 (((color_def->green >> 8) - (cells[x].green >> 8))
|
442
|
195 * ((color_def->green >> 8) - (cells[x].green >>
|
|
196 8)))
|
428
|
197 +
|
|
198 (((color_def->blue >> 8) - (cells[x].blue >> 8))
|
442
|
199 * ((color_def->blue >> 8) - (cells[x].blue >>
|
|
200 8))));
|
428
|
201
|
|
202 /* less? Ignore cells marked as previously failing */
|
|
203 if( (trial_delta < nearest_delta) &&
|
|
204 (cells[x].pixel != ULONG_MAX) )
|
|
205 {
|
|
206 nearest = x;
|
|
207 nearest_delta = trial_delta;
|
|
208 }
|
|
209 }
|
|
210 color_def->red = cells[nearest].red;
|
|
211 color_def->green = cells[nearest].green;
|
|
212 color_def->blue = cells[nearest].blue;
|
|
213 if (XAllocColor (display, colormap, color_def) != 0)
|
442
|
214 status = 2;
|
428
|
215 else
|
442
|
216 /* LSK: Either the colour map has changed since
|
|
217 * we read it, or the colour is allocated
|
|
218 * read/write... Mark this cmap entry so it's
|
|
219 * ignored in the next iteration.
|
|
220 */
|
|
221 cells[nearest].pixel = ULONG_MAX;
|
428
|
222 }
|
|
223 }
|
|
224 return status;
|
|
225 }
|
|
226
|
442
|
227 static int
|
|
228 x_parse_nearest_color (struct device *d, XColor *color, Lisp_Object name,
|
578
|
229 Error_Behavior errb)
|
428
|
230 {
|
|
231 Display *dpy = DEVICE_X_DISPLAY (d);
|
|
232 Colormap cmap = DEVICE_X_COLORMAP (d);
|
|
233 Visual *visual = DEVICE_X_VISUAL (d);
|
|
234 int result;
|
|
235
|
|
236 xzero (*color);
|
|
237 {
|
442
|
238 const Extbyte *extname;
|
428
|
239
|
442
|
240 LISP_STRING_TO_EXTERNAL (name, extname, Qx_color_name_encoding);
|
|
241 result = XParseColor (dpy, cmap, extname, color);
|
428
|
242 }
|
|
243 if (!result)
|
|
244 {
|
563
|
245 maybe_signal_error (Qgui_error, "Unrecognized color",
|
|
246 name, Qcolor, errb);
|
428
|
247 return 0;
|
|
248 }
|
|
249 result = allocate_nearest_color (dpy, cmap, visual, color);
|
|
250 if (!result)
|
|
251 {
|
563
|
252 maybe_signal_error (Qgui_error, "Couldn't allocate color",
|
|
253 name, Qcolor, errb);
|
428
|
254 return 0;
|
|
255 }
|
|
256
|
|
257 return result;
|
|
258 }
|
|
259
|
|
260 static int
|
440
|
261 x_initialize_color_instance (Lisp_Color_Instance *c, Lisp_Object name,
|
578
|
262 Lisp_Object device, Error_Behavior errb)
|
428
|
263 {
|
|
264 XColor color;
|
|
265 int result;
|
|
266
|
442
|
267 result = x_parse_nearest_color (XDEVICE (device), &color, name, errb);
|
428
|
268
|
|
269 if (!result)
|
|
270 return 0;
|
|
271
|
|
272 /* Don't allocate the data until we're sure that we will succeed,
|
|
273 or the finalize method may get fucked. */
|
|
274 c->data = xnew (struct x_color_instance_data);
|
|
275 if (result == 3)
|
|
276 COLOR_INSTANCE_X_DEALLOC (c) = 0;
|
|
277 else
|
|
278 COLOR_INSTANCE_X_DEALLOC (c) = 1;
|
|
279 COLOR_INSTANCE_X_COLOR (c) = color;
|
|
280 return 1;
|
|
281 }
|
|
282
|
|
283 static void
|
440
|
284 x_print_color_instance (Lisp_Color_Instance *c,
|
428
|
285 Lisp_Object printcharfun,
|
2286
|
286 int UNUSED (escapeflag))
|
428
|
287 {
|
|
288 XColor color = COLOR_INSTANCE_X_COLOR (c);
|
800
|
289 write_fmt_string (printcharfun, " %ld=(%X,%X,%X)",
|
|
290 color.pixel, color.red, color.green, color.blue);
|
428
|
291 }
|
|
292
|
|
293 static void
|
440
|
294 x_finalize_color_instance (Lisp_Color_Instance *c)
|
428
|
295 {
|
|
296 if (c->data)
|
|
297 {
|
|
298 if (DEVICE_LIVE_P (XDEVICE (c->device)))
|
|
299 {
|
|
300 if (COLOR_INSTANCE_X_DEALLOC (c))
|
|
301 {
|
442
|
302 XFreeColors (DEVICE_X_DISPLAY (XDEVICE (c->device)),
|
|
303 DEVICE_X_COLORMAP (XDEVICE (c->device)),
|
428
|
304 &COLOR_INSTANCE_X_COLOR (c).pixel, 1, 0);
|
|
305 }
|
|
306 }
|
1726
|
307 xfree (c->data, void *);
|
428
|
308 c->data = 0;
|
|
309 }
|
|
310 }
|
|
311
|
|
312 /* Color instances are equal if they resolve to the same color on the
|
|
313 screen (have the same RGB values). I imagine that
|
|
314 "same RGB values" == "same cell in the colormap." Arguably we should
|
|
315 be comparing their names or pixel values instead. */
|
|
316
|
|
317 static int
|
440
|
318 x_color_instance_equal (Lisp_Color_Instance *c1,
|
|
319 Lisp_Color_Instance *c2,
|
2286
|
320 int UNUSED (depth))
|
428
|
321 {
|
|
322 XColor color1 = COLOR_INSTANCE_X_COLOR (c1);
|
|
323 XColor color2 = COLOR_INSTANCE_X_COLOR (c2);
|
|
324 return ((color1.red == color2.red) &&
|
|
325 (color1.green == color2.green) &&
|
|
326 (color1.blue == color2.blue));
|
|
327 }
|
|
328
|
2515
|
329 static Hashcode
|
2286
|
330 x_color_instance_hash (Lisp_Color_Instance *c, int UNUSED (depth))
|
428
|
331 {
|
|
332 XColor color = COLOR_INSTANCE_X_COLOR (c);
|
|
333 return HASH3 (color.red, color.green, color.blue);
|
|
334 }
|
|
335
|
|
336 static Lisp_Object
|
440
|
337 x_color_instance_rgb_components (Lisp_Color_Instance *c)
|
428
|
338 {
|
|
339 XColor color = COLOR_INSTANCE_X_COLOR (c);
|
|
340 return (list3 (make_int (color.red),
|
|
341 make_int (color.green),
|
|
342 make_int (color.blue)));
|
|
343 }
|
|
344
|
|
345 static int
|
|
346 x_valid_color_name_p (struct device *d, Lisp_Object color)
|
|
347 {
|
|
348 XColor c;
|
|
349 Display *dpy = DEVICE_X_DISPLAY (d);
|
|
350 Colormap cmap = DEVICE_X_COLORMAP (d);
|
442
|
351 const Extbyte *extname;
|
428
|
352
|
442
|
353 LISP_STRING_TO_EXTERNAL (color, extname, Qx_color_name_encoding);
|
428
|
354
|
440
|
355 return XParseColor (dpy, cmap, extname, &c);
|
428
|
356 }
|
|
357
|
2527
|
358 static Lisp_Object
|
|
359 x_color_list (void)
|
|
360 {
|
|
361 return call0 (intern ("x-color-list-internal"));
|
|
362 }
|
|
363
|
428
|
364
|
|
365 /************************************************************************/
|
|
366 /* font instances */
|
|
367 /************************************************************************/
|
|
368
|
|
369 static int
|
2286
|
370 x_initialize_font_instance (Lisp_Font_Instance *f, Lisp_Object UNUSED (name),
|
578
|
371 Lisp_Object device, Error_Behavior errb)
|
428
|
372 {
|
440
|
373 Display *dpy = DEVICE_X_DISPLAY (XDEVICE (device));
|
428
|
374 XFontStruct *xf;
|
442
|
375 const Extbyte *extname;
|
428
|
376
|
442
|
377 LISP_STRING_TO_EXTERNAL (f->name, extname, Qx_font_name_encoding);
|
428
|
378 xf = XLoadQueryFont (dpy, extname);
|
|
379
|
|
380 if (!xf)
|
|
381 {
|
563
|
382 maybe_signal_error (Qgui_error, "Couldn't load font", f->name, Qfont,
|
|
383 errb);
|
428
|
384 return 0;
|
|
385 }
|
|
386
|
|
387 if (!xf->max_bounds.width)
|
|
388 {
|
|
389 /* yes, this has been known to happen. */
|
|
390 XFreeFont (dpy, xf);
|
563
|
391 maybe_signal_error (Qgui_error, "X font is too small", f->name, Qfont,
|
|
392 errb);
|
428
|
393 return 0;
|
|
394 }
|
|
395
|
|
396 /* Don't allocate the data until we're sure that we will succeed,
|
|
397 or the finalize method may get fucked. */
|
|
398 f->data = xnew (struct x_font_instance_data);
|
|
399 FONT_INSTANCE_X_FONT (f) = xf;
|
|
400 f->ascent = xf->ascent;
|
|
401 f->descent = xf->descent;
|
|
402 f->height = xf->ascent + xf->descent;
|
|
403 {
|
|
404 /* following change suggested by Ted Phelps <phelps@dstc.edu.au> */
|
647
|
405 int def_char = 'n'; /*xf->default_char;*/
|
|
406 int byte1, byte2;
|
428
|
407
|
|
408 once_more:
|
|
409 byte1 = def_char >> 8;
|
|
410 byte2 = def_char & 0xFF;
|
|
411
|
|
412 if (xf->per_char)
|
|
413 {
|
|
414 /* Old versions of the R5 font server have garbage (>63k) as
|
|
415 def_char. 'n' might not be a valid character. */
|
647
|
416 if (byte1 < (int) xf->min_byte1 ||
|
|
417 byte1 > (int) xf->max_byte1 ||
|
|
418 byte2 < (int) xf->min_char_or_byte2 ||
|
|
419 byte2 > (int) xf->max_char_or_byte2)
|
428
|
420 f->width = 0;
|
|
421 else
|
|
422 f->width = xf->per_char[(byte1 - xf->min_byte1) *
|
|
423 (xf->max_char_or_byte2 -
|
|
424 xf->min_char_or_byte2 + 1) +
|
|
425 (byte2 - xf->min_char_or_byte2)].width;
|
|
426 }
|
|
427 else
|
|
428 f->width = xf->max_bounds.width;
|
|
429
|
|
430 /* Some fonts have a default char whose width is 0. This is no good.
|
|
431 If that's the case, first try 'n' as the default char, and if n has
|
|
432 0 width too (unlikely) then just use the max width. */
|
|
433 if (f->width == 0)
|
|
434 {
|
647
|
435 if (def_char == (int) xf->default_char)
|
428
|
436 f->width = xf->max_bounds.width;
|
|
437 else
|
|
438 {
|
|
439 def_char = xf->default_char;
|
|
440 goto once_more;
|
|
441 }
|
|
442 }
|
|
443 }
|
|
444 /* If all characters don't exist then there could potentially be
|
|
445 0-width characters lurking out there. Not setting this flag
|
|
446 trips an optimization that would make them appear to have width
|
|
447 to redisplay. This is bad. So we set it if not all characters
|
|
448 have the same width or if not all characters are defined.
|
|
449 */
|
|
450 /* #### This sucks. There is a measurable performance increase
|
|
451 when using proportional width fonts if this flag is not set.
|
|
452 Unfortunately so many of the fucking X fonts are not fully
|
|
453 defined that we could almost just get rid of this damn flag and
|
|
454 make it an assertion. */
|
|
455 f->proportional_p = (xf->min_bounds.width != xf->max_bounds.width ||
|
|
456 (x_handle_non_fully_specified_fonts &&
|
|
457 !xf->all_chars_exist));
|
|
458
|
|
459 return 1;
|
|
460 }
|
|
461
|
|
462 static void
|
440
|
463 x_print_font_instance (Lisp_Font_Instance *f,
|
428
|
464 Lisp_Object printcharfun,
|
2286
|
465 int UNUSED (escapeflag))
|
428
|
466 {
|
800
|
467 write_fmt_string (printcharfun, " 0x%lx",
|
|
468 (unsigned long) FONT_INSTANCE_X_FONT (f)->fid);
|
428
|
469 }
|
|
470
|
|
471 static void
|
440
|
472 x_finalize_font_instance (Lisp_Font_Instance *f)
|
428
|
473 {
|
|
474
|
|
475 if (f->data)
|
|
476 {
|
|
477 if (DEVICE_LIVE_P (XDEVICE (f->device)))
|
|
478 {
|
|
479 Display *dpy = DEVICE_X_DISPLAY (XDEVICE (f->device));
|
|
480
|
|
481 XFreeFont (dpy, FONT_INSTANCE_X_FONT (f));
|
|
482 }
|
1726
|
483 xfree (f->data, void *);
|
428
|
484 f->data = 0;
|
|
485 }
|
|
486 }
|
|
487
|
|
488 /* Determining the truename of a font is hard. (Big surprise.)
|
|
489
|
|
490 By "truename" we mean an XLFD-form name which contains no wildcards, yet
|
|
491 which resolves to *exactly* the same font as the one which we already have
|
|
492 the (probably wildcarded) name and `XFontStruct' of.
|
|
493
|
|
494 One might think that the first font returned by XListFonts would be the one
|
|
495 that XOpenFont would pick. Apparently this is the case on some servers,
|
|
496 but not on others. It would seem not to be specified.
|
|
497
|
|
498 The MIT R5 server sometimes appears to be picking the lexicographically
|
|
499 smallest font which matches the name (thus picking "adobe" fonts before
|
|
500 "bitstream" fonts even if the bitstream fonts are earlier in the path, and
|
|
501 also picking 100dpi adobe fonts over 75dpi adobe fonts even though the
|
|
502 75dpi are in the path earlier) but sometimes appears to be doing something
|
442
|
503 else entirely (for example, removing the bitstream fonts from the path will
|
428
|
504 cause the 75dpi adobe fonts to be used instead of the 100dpi, even though
|
|
505 their relative positions in the path (and their names!) have not changed).
|
|
506
|
|
507 The documentation for XSetFontPath() seems to indicate that the order of
|
442
|
508 entries in the font path means something, but it's pretty noncommittal about
|
428
|
509 it, and the spirit of the law is apparently not being obeyed...
|
|
510
|
|
511 All the fonts I've seen have a property named `FONT' which contains the
|
|
512 truename of the font. However, there are two problems with using this: the
|
|
513 first is that the X Protocol Document is quite explicit that all properties
|
|
514 are optional, so we can't depend on it being there. The second is that
|
|
515 it's conceivable that this alleged truename isn't actually accessible as a
|
|
516 font, due to some difference of opinion between the font designers and
|
|
517 whoever installed the font on the system.
|
|
518
|
|
519 So, our first attempt is to look for a FONT property, and then verify that
|
|
520 the name there is a valid name by running XListFonts on it. There's still
|
|
521 the potential that this could be true but we could still be being lied to,
|
|
522 but that seems pretty remote.
|
|
523
|
|
524 Late breaking news: I've gotten reports that SunOS 4.1.3U1
|
|
525 with OpenWound 3.0 has a font whose truename is really
|
|
526 "-Adobe-Courier-Medium-R-Normal--12-120-75-75-M-70-ISO8859-1"
|
|
527 but whose FONT property contains "Courier".
|
|
528
|
|
529 So we disbelieve the FONT property unless it begins with a dash and
|
|
530 is more than 30 characters long. X Windows: The defacto substandard.
|
|
531 X Windows: Complex nonsolutions to simple nonproblems. X Windows:
|
|
532 Live the nightmare.
|
|
533
|
|
534 If the FONT property doesn't exist, then we try and construct an XLFD name
|
|
535 out of the other font properties (FOUNDRY, FAMILY_NAME, WEIGHT_NAME, etc).
|
|
536 This is necessary at least for some versions of OpenWound. But who knows
|
|
537 what the future will bring.
|
|
538
|
|
539 If that doesn't work, then we use XListFonts and either take the first font
|
|
540 (which I think is the most sensible thing) or we find the lexicographically
|
|
541 least, depending on whether the preprocessor constant `XOPENFONT_SORTS' is
|
|
542 defined. This sucks because the two behaviors are a property of the server
|
|
543 being used, not the architecture on which emacs has been compiled. Also,
|
|
544 as I described above, sorting isn't ALWAYS what the server does. Really it
|
|
545 does something seemingly random. There is no reliable way to win if the
|
|
546 FONT property isn't present.
|
|
547
|
|
548 Another possibility which I haven't bothered to implement would be to map
|
|
549 over all of the matching fonts and find the first one that has the same
|
|
550 character metrics as the font we already have loaded. Even if this didn't
|
|
551 return exactly the same font, it would at least return one whose characters
|
|
552 were the same sizes, which would probably be good enough.
|
|
553
|
|
554 More late-breaking news: on RS/6000 AIX 3.2.4, the expression
|
|
555 XLoadQueryFont (dpy, "-*-Fixed-Medium-R-*-*-*-130-75-75-*-*-ISO8859-1")
|
|
556 actually returns the font
|
|
557 -Misc-Fixed-Medium-R-Normal--13-120-75-75-C-80-ISO8859-1
|
|
558 which is crazy, because that font doesn't even match that pattern! It is
|
|
559 also not included in the output produced by `xlsfonts' with that pattern.
|
|
560
|
|
561 So this is yet another example of XListFonts() and XOpenFont() using
|
|
562 completely different algorithms. This, however, is a goofier example of
|
|
563 this bug, because in this case, it's not just the search order that is
|
|
564 different -- the sets don't even intersect.
|
|
565
|
|
566 If anyone has any better ideas how to do this, or any insights on what it is
|
|
567 that the various servers are actually doing, please let me know! -- jwz. */
|
|
568
|
|
569 static int
|
442
|
570 valid_x_font_name_p (Display *dpy, Extbyte *name)
|
428
|
571 {
|
|
572 /* Maybe this should be implemented by calling XLoadFont and trapping
|
|
573 the error. That would be a lot of work, and wasteful as hell, but
|
|
574 might be more correct.
|
|
575 */
|
|
576 int nnames = 0;
|
444
|
577 Extbyte **names = 0;
|
428
|
578 if (! name)
|
|
579 return 0;
|
|
580 names = XListFonts (dpy, name, 1, &nnames);
|
|
581 if (names)
|
|
582 XFreeFontNames (names);
|
|
583 return (nnames != 0);
|
|
584 }
|
|
585
|
442
|
586 static Extbyte *
|
428
|
587 truename_via_FONT_prop (Display *dpy, XFontStruct *font)
|
|
588 {
|
|
589 unsigned long value = 0;
|
442
|
590 Extbyte *result = 0;
|
428
|
591 if (XGetFontProperty (font, XA_FONT, &value))
|
|
592 result = XGetAtomName (dpy, value);
|
|
593 /* result is now 0, or the string value of the FONT property. */
|
|
594 if (result)
|
|
595 {
|
|
596 /* Verify that result is an XLFD name (roughly...) */
|
647
|
597 if (result [0] != '-' || strlen (result) < 30)
|
428
|
598 {
|
|
599 XFree (result);
|
|
600 result = 0;
|
|
601 }
|
|
602 }
|
|
603 return result; /* this must be freed by caller if non-0 */
|
|
604 }
|
|
605
|
442
|
606 static Extbyte *
|
428
|
607 truename_via_random_props (Display *dpy, XFontStruct *font)
|
|
608 {
|
|
609 struct device *d = get_device_from_display (dpy);
|
|
610 unsigned long value = 0;
|
442
|
611 Extbyte *foundry, *family, *weight, *slant, *setwidth, *add_style;
|
428
|
612 unsigned long pixel, point, res_x, res_y;
|
442
|
613 Extbyte *spacing;
|
428
|
614 unsigned long avg_width;
|
442
|
615 Extbyte *registry, *encoding;
|
|
616 Extbyte composed_name [2048];
|
428
|
617 int ok = 0;
|
442
|
618 Extbyte *result;
|
428
|
619
|
|
620 #define get_string(atom,var) \
|
|
621 if (XGetFontProperty (font, (atom), &value)) \
|
|
622 var = XGetAtomName (dpy, value); \
|
|
623 else { \
|
|
624 var = 0; \
|
|
625 goto FAIL; }
|
|
626 #define get_number(atom,var) \
|
|
627 if (!XGetFontProperty (font, (atom), &var) || \
|
|
628 var > 999) \
|
|
629 goto FAIL;
|
|
630
|
|
631 foundry = family = weight = slant = setwidth = 0;
|
|
632 add_style = spacing = registry = encoding = 0;
|
|
633
|
|
634 get_string (DEVICE_XATOM_FOUNDRY (d), foundry);
|
|
635 get_string (DEVICE_XATOM_FAMILY_NAME (d), family);
|
|
636 get_string (DEVICE_XATOM_WEIGHT_NAME (d), weight);
|
|
637 get_string (DEVICE_XATOM_SLANT (d), slant);
|
|
638 get_string (DEVICE_XATOM_SETWIDTH_NAME (d), setwidth);
|
|
639 get_string (DEVICE_XATOM_ADD_STYLE_NAME (d), add_style);
|
|
640 get_number (DEVICE_XATOM_PIXEL_SIZE (d), pixel);
|
|
641 get_number (DEVICE_XATOM_POINT_SIZE (d), point);
|
|
642 get_number (DEVICE_XATOM_RESOLUTION_X (d), res_x);
|
|
643 get_number (DEVICE_XATOM_RESOLUTION_Y (d), res_y);
|
|
644 get_string (DEVICE_XATOM_SPACING (d), spacing);
|
|
645 get_number (DEVICE_XATOM_AVERAGE_WIDTH (d), avg_width);
|
|
646 get_string (DEVICE_XATOM_CHARSET_REGISTRY (d), registry);
|
|
647 get_string (DEVICE_XATOM_CHARSET_ENCODING (d), encoding);
|
|
648 #undef get_number
|
|
649 #undef get_string
|
|
650
|
|
651 sprintf (composed_name,
|
|
652 "-%s-%s-%s-%s-%s-%s-%ld-%ld-%ld-%ld-%s-%ld-%s-%s",
|
|
653 foundry, family, weight, slant, setwidth, add_style, pixel,
|
|
654 point, res_x, res_y, spacing, avg_width, registry, encoding);
|
|
655 ok = 1;
|
|
656
|
|
657 FAIL:
|
|
658 if (ok)
|
|
659 {
|
|
660 int L = strlen (composed_name) + 1;
|
2367
|
661 result = xnew_extbytes (L);
|
428
|
662 strncpy (result, composed_name, L);
|
|
663 }
|
|
664 else
|
|
665 result = 0;
|
|
666
|
|
667 if (foundry) XFree (foundry);
|
|
668 if (family) XFree (family);
|
|
669 if (weight) XFree (weight);
|
|
670 if (slant) XFree (slant);
|
|
671 if (setwidth) XFree (setwidth);
|
|
672 if (add_style) XFree (add_style);
|
|
673 if (spacing) XFree (spacing);
|
|
674 if (registry) XFree (registry);
|
|
675 if (encoding) XFree (encoding);
|
|
676
|
|
677 return result;
|
|
678 }
|
|
679
|
|
680 /* Unbounded, for sufficiently small values of infinity... */
|
|
681 #define MAX_FONT_COUNT 5000
|
|
682
|
442
|
683 static Extbyte *
|
|
684 truename_via_XListFonts (Display *dpy, Extbyte *font_name)
|
428
|
685 {
|
442
|
686 Extbyte *result = 0;
|
444
|
687 Extbyte **names;
|
428
|
688 int count = 0;
|
|
689
|
|
690 #ifndef XOPENFONT_SORTS
|
|
691 /* In a sensible world, the first font returned by XListFonts()
|
|
692 would be the font that XOpenFont() would use. */
|
|
693 names = XListFonts (dpy, font_name, 1, &count);
|
|
694 if (count) result = names [0];
|
|
695 #else
|
|
696 /* But the world I live in is much more perverse. */
|
|
697 names = XListFonts (dpy, font_name, MAX_FONT_COUNT, &count);
|
|
698 while (count--)
|
442
|
699 /* !!#### Not Mule-friendly */
|
428
|
700 /* If names[count] is lexicographically less than result, use it.
|
|
701 (#### Should we be comparing case-insensitively?) */
|
|
702 if (result == 0 || (strcmp (result, names [count]) < 0))
|
|
703 result = names [count];
|
|
704 #endif
|
|
705
|
|
706 if (result)
|
|
707 result = xstrdup (result);
|
|
708 if (names)
|
|
709 XFreeFontNames (names);
|
|
710
|
|
711 return result; /* this must be freed by caller if non-0 */
|
|
712 }
|
|
713
|
|
714 static Lisp_Object
|
442
|
715 x_font_truename (Display *dpy, Extbyte *name, XFontStruct *font)
|
428
|
716 {
|
442
|
717 Extbyte *truename_FONT = 0;
|
|
718 Extbyte *truename_random = 0;
|
|
719 Extbyte *truename = 0;
|
428
|
720
|
|
721 /* The search order is:
|
|
722 - if FONT property exists, and is a valid name, return it.
|
|
723 - if the other props exist, and add up to a valid name, return it.
|
|
724 - if we find a matching name with XListFonts, return it.
|
|
725 - if FONT property exists, return it regardless.
|
|
726 - if other props exist, return the resultant name regardless.
|
|
727 - else return 0.
|
|
728 */
|
|
729
|
|
730 truename = truename_FONT = truename_via_FONT_prop (dpy, font);
|
|
731 if (truename && !valid_x_font_name_p (dpy, truename))
|
|
732 truename = 0;
|
|
733 if (!truename)
|
|
734 truename = truename_random = truename_via_random_props (dpy, font);
|
|
735 if (truename && !valid_x_font_name_p (dpy, truename))
|
|
736 truename = 0;
|
|
737 if (!truename && name)
|
|
738 truename = truename_via_XListFonts (dpy, name);
|
|
739
|
|
740 if (!truename)
|
|
741 {
|
|
742 /* Gag - we weren't able to find a seemingly-valid truename.
|
|
743 Well, maybe we're on one of those braindead systems where
|
|
744 XListFonts() and XLoadFont() are in violent disagreement.
|
|
745 If we were able to compute a truename, try using that even
|
|
746 if evidence suggests that it's not a valid name - because
|
|
747 maybe it is, really, and that's better than nothing.
|
|
748 X Windows: You'll envy the dead.
|
|
749 */
|
|
750 if (truename_FONT)
|
|
751 truename = truename_FONT;
|
|
752 else if (truename_random)
|
|
753 truename = truename_random;
|
|
754 }
|
|
755
|
|
756 /* One or both of these are not being used - free them. */
|
|
757 if (truename_FONT && truename_FONT != truename)
|
|
758 XFree (truename_FONT);
|
|
759 if (truename_random && truename_random != truename)
|
|
760 XFree (truename_random);
|
|
761
|
|
762 if (truename)
|
|
763 {
|
442
|
764 Lisp_Object result = build_ext_string (truename, Qx_font_name_encoding);
|
428
|
765 XFree (truename);
|
|
766 return result;
|
|
767 }
|
|
768 else
|
|
769 return Qnil;
|
|
770 }
|
|
771
|
|
772 static Lisp_Object
|
578
|
773 x_font_instance_truename (Lisp_Font_Instance *f, Error_Behavior errb)
|
428
|
774 {
|
|
775 struct device *d = XDEVICE (f->device);
|
|
776
|
872
|
777 if (NILP (FONT_INSTANCE_TRUENAME (f)))
|
428
|
778 {
|
|
779 Display *dpy = DEVICE_X_DISPLAY (d);
|
|
780 {
|
442
|
781 Extbyte *nameext;
|
|
782
|
|
783 LISP_STRING_TO_EXTERNAL (f->name, nameext, Qx_font_name_encoding);
|
872
|
784 FONT_INSTANCE_TRUENAME (f) =
|
442
|
785 x_font_truename (dpy, nameext, FONT_INSTANCE_X_FONT (f));
|
428
|
786 }
|
872
|
787 if (NILP (FONT_INSTANCE_TRUENAME (f)))
|
428
|
788 {
|
793
|
789 Lisp_Object font_instance = wrap_font_instance (f);
|
|
790
|
428
|
791
|
563
|
792 maybe_signal_error (Qgui_error, "Couldn't determine font truename",
|
|
793 font_instance, Qfont, errb);
|
428
|
794 /* Ok, just this once, return the font name as the truename.
|
|
795 (This is only used by Fequal() right now.) */
|
|
796 return f->name;
|
|
797 }
|
|
798 }
|
872
|
799 return FONT_INSTANCE_TRUENAME (f);
|
428
|
800 }
|
|
801
|
|
802 static Lisp_Object
|
440
|
803 x_font_instance_properties (Lisp_Font_Instance *f)
|
428
|
804 {
|
|
805 struct device *d = XDEVICE (f->device);
|
|
806 int i;
|
|
807 Lisp_Object result = Qnil;
|
444
|
808 Display *dpy = DEVICE_X_DISPLAY (d);
|
|
809 XFontProp *props = FONT_INSTANCE_X_FONT (f)->properties;
|
428
|
810
|
|
811 for (i = FONT_INSTANCE_X_FONT (f)->n_properties - 1; i >= 0; i--)
|
|
812 {
|
|
813 Lisp_Object name, value;
|
|
814 Atom atom = props [i].name;
|
867
|
815 Ibyte *name_str = 0;
|
647
|
816 Bytecount name_len;
|
442
|
817 Extbyte *namestrext = XGetAtomName (dpy, atom);
|
|
818
|
|
819 if (namestrext)
|
444
|
820 TO_INTERNAL_FORMAT (C_STRING, namestrext,
|
|
821 ALLOCA, (name_str, name_len),
|
|
822 Qx_atom_name_encoding);
|
442
|
823
|
771
|
824 name = (name_str ? intern_int (name_str) : Qnil);
|
428
|
825 if (name_str &&
|
|
826 (atom == XA_FONT ||
|
|
827 atom == DEVICE_XATOM_FOUNDRY (d) ||
|
|
828 atom == DEVICE_XATOM_FAMILY_NAME (d) ||
|
|
829 atom == DEVICE_XATOM_WEIGHT_NAME (d) ||
|
|
830 atom == DEVICE_XATOM_SLANT (d) ||
|
|
831 atom == DEVICE_XATOM_SETWIDTH_NAME (d) ||
|
|
832 atom == DEVICE_XATOM_ADD_STYLE_NAME (d) ||
|
|
833 atom == DEVICE_XATOM_SPACING (d) ||
|
|
834 atom == DEVICE_XATOM_CHARSET_REGISTRY (d) ||
|
|
835 atom == DEVICE_XATOM_CHARSET_ENCODING (d) ||
|
2367
|
836 !qxestrcmp_ascii (name_str, "CHARSET_COLLECTIONS") ||
|
|
837 !qxestrcmp_ascii (name_str, "FONTNAME_REGISTRY") ||
|
|
838 !qxestrcmp_ascii (name_str, "CLASSIFICATION") ||
|
|
839 !qxestrcmp_ascii (name_str, "COPYRIGHT") ||
|
|
840 !qxestrcmp_ascii (name_str, "DEVICE_FONT_NAME") ||
|
|
841 !qxestrcmp_ascii (name_str, "FULL_NAME") ||
|
|
842 !qxestrcmp_ascii (name_str, "MONOSPACED") ||
|
|
843 !qxestrcmp_ascii (name_str, "QUALITY") ||
|
|
844 !qxestrcmp_ascii (name_str, "RELATIVE_SET") ||
|
|
845 !qxestrcmp_ascii (name_str, "RELATIVE_WEIGHT") ||
|
|
846 !qxestrcmp_ascii (name_str, "STYLE")))
|
428
|
847 {
|
442
|
848 Extbyte *val_str = XGetAtomName (dpy, props [i].card32);
|
|
849
|
|
850 value = (val_str ? build_ext_string (val_str, Qx_atom_name_encoding)
|
|
851 : Qnil);
|
428
|
852 }
|
|
853 else
|
|
854 value = make_int (props [i].card32);
|
442
|
855 if (namestrext) XFree (namestrext);
|
428
|
856 result = Fcons (Fcons (name, value), result);
|
|
857 }
|
|
858 return result;
|
|
859 }
|
|
860
|
|
861 static Lisp_Object
|
2527
|
862 x_font_list (Lisp_Object pattern, Lisp_Object device, Lisp_Object maxnumber)
|
428
|
863 {
|
444
|
864 Extbyte **names;
|
428
|
865 int count = 0;
|
1701
|
866 int max_number = MAX_FONT_COUNT;
|
428
|
867 Lisp_Object result = Qnil;
|
442
|
868 const Extbyte *patternext;
|
428
|
869
|
442
|
870 LISP_STRING_TO_EXTERNAL (pattern, patternext, Qx_font_name_encoding);
|
428
|
871
|
1701
|
872 if (!NILP(maxnumber) && INTP(maxnumber))
|
|
873 {
|
|
874 max_number = XINT(maxnumber);
|
|
875 }
|
|
876
|
428
|
877 names = XListFonts (DEVICE_X_DISPLAY (XDEVICE (device)),
|
1701
|
878 patternext, max_number, &count);
|
428
|
879 while (count--)
|
442
|
880 result = Fcons (build_ext_string (names[count], Qx_font_name_encoding),
|
|
881 result);
|
428
|
882 if (names)
|
|
883 XFreeFontNames (names);
|
|
884 return result;
|
|
885 }
|
|
886
|
|
887 #ifdef MULE
|
|
888
|
|
889 static int
|
2286
|
890 x_font_spec_matches_charset (struct device *UNUSED (d), Lisp_Object charset,
|
867
|
891 const Ibyte *nonreloc, Lisp_Object reloc,
|
872
|
892 Bytecount offset, Bytecount length,
|
|
893 int stage)
|
428
|
894 {
|
872
|
895 if (stage)
|
|
896 return 0;
|
|
897
|
428
|
898 if (UNBOUNDP (charset))
|
|
899 return 1;
|
|
900 /* Hack! Short font names don't have the registry in them,
|
|
901 so we just assume the user knows what they're doing in the
|
|
902 case of ASCII. For other charsets, you gotta give the
|
|
903 long form; sorry buster.
|
|
904 */
|
|
905 if (EQ (charset, Vcharset_ascii))
|
|
906 {
|
867
|
907 const Ibyte *the_nonreloc = nonreloc;
|
428
|
908 int i;
|
|
909 Bytecount the_length = length;
|
|
910
|
|
911 if (!the_nonreloc)
|
|
912 the_nonreloc = XSTRING_DATA (reloc);
|
|
913 fixup_internal_substring (nonreloc, reloc, offset, &the_length);
|
|
914 the_nonreloc += offset;
|
|
915 if (!memchr (the_nonreloc, '*', the_length))
|
|
916 {
|
|
917 for (i = 0;; i++)
|
|
918 {
|
867
|
919 const Ibyte *new_nonreloc = (const Ibyte *)
|
428
|
920 memchr (the_nonreloc, '-', the_length);
|
|
921 if (!new_nonreloc)
|
|
922 break;
|
|
923 new_nonreloc++;
|
|
924 the_length -= new_nonreloc - the_nonreloc;
|
|
925 the_nonreloc = new_nonreloc;
|
|
926 }
|
|
927
|
|
928 /* If it has less than 5 dashes, it's a short font.
|
|
929 Of course, long fonts always have 14 dashes or so, but short
|
|
930 fonts never have more than 1 or 2 dashes, so this is some
|
|
931 sort of reasonable heuristic. */
|
|
932 if (i < 5)
|
|
933 return 1;
|
|
934 }
|
|
935 }
|
|
936
|
|
937 return (fast_string_match (XCHARSET_REGISTRY (charset),
|
|
938 nonreloc, reloc, offset, length, 1,
|
|
939 ERROR_ME, 0) >= 0);
|
|
940 }
|
|
941
|
|
942 /* find a font spec that matches font spec FONT and also matches
|
|
943 (the registry of) CHARSET. */
|
|
944 static Lisp_Object
|
872
|
945 x_find_charset_font (Lisp_Object device, Lisp_Object font, Lisp_Object charset,
|
|
946 int stage)
|
428
|
947 {
|
444
|
948 Extbyte **names;
|
428
|
949 int count = 0;
|
|
950 Lisp_Object result = Qnil;
|
442
|
951 const Extbyte *patternext;
|
428
|
952 int i;
|
|
953
|
872
|
954 if (stage)
|
|
955 return Qnil;
|
|
956
|
442
|
957 LISP_STRING_TO_EXTERNAL (font, patternext, Qx_font_name_encoding);
|
428
|
958
|
|
959 names = XListFonts (DEVICE_X_DISPLAY (XDEVICE (device)),
|
|
960 patternext, MAX_FONT_COUNT, &count);
|
440
|
961 /* #### This code seems awfully bogus -- mrb */
|
428
|
962 for (i = 0; i < count; i ++)
|
|
963 {
|
867
|
964 const Ibyte *intname;
|
444
|
965 Bytecount intlen;
|
428
|
966
|
444
|
967 TO_INTERNAL_FORMAT (C_STRING, names[i],
|
|
968 ALLOCA, (intname, intlen),
|
|
969 Qx_font_name_encoding);
|
428
|
970 if (x_font_spec_matches_charset (XDEVICE (device), charset,
|
872
|
971 intname, Qnil, 0, -1, 0))
|
428
|
972 {
|
444
|
973 result = make_string (intname, intlen);
|
428
|
974 break;
|
|
975 }
|
|
976 }
|
|
977
|
|
978 if (names)
|
|
979 XFreeFontNames (names);
|
|
980
|
|
981 /* Check for a short font name. */
|
|
982 if (NILP (result)
|
|
983 && x_font_spec_matches_charset (XDEVICE (device), charset, 0,
|
872
|
984 font, 0, -1, 0))
|
428
|
985 return font;
|
|
986
|
|
987 return result;
|
|
988 }
|
|
989
|
|
990 #endif /* MULE */
|
|
991
|
|
992
|
|
993 /************************************************************************/
|
|
994 /* initialization */
|
|
995 /************************************************************************/
|
|
996
|
|
997 void
|
|
998 syms_of_objects_x (void)
|
|
999 {
|
|
1000 }
|
|
1001
|
|
1002 void
|
|
1003 console_type_create_objects_x (void)
|
|
1004 {
|
|
1005 /* object methods */
|
|
1006
|
|
1007 CONSOLE_HAS_METHOD (x, initialize_color_instance);
|
|
1008 CONSOLE_HAS_METHOD (x, print_color_instance);
|
|
1009 CONSOLE_HAS_METHOD (x, finalize_color_instance);
|
|
1010 CONSOLE_HAS_METHOD (x, color_instance_equal);
|
|
1011 CONSOLE_HAS_METHOD (x, color_instance_hash);
|
|
1012 CONSOLE_HAS_METHOD (x, color_instance_rgb_components);
|
|
1013 CONSOLE_HAS_METHOD (x, valid_color_name_p);
|
2527
|
1014 CONSOLE_HAS_METHOD (x, color_list);
|
428
|
1015
|
|
1016 CONSOLE_HAS_METHOD (x, initialize_font_instance);
|
|
1017 CONSOLE_HAS_METHOD (x, print_font_instance);
|
|
1018 CONSOLE_HAS_METHOD (x, finalize_font_instance);
|
|
1019 CONSOLE_HAS_METHOD (x, font_instance_truename);
|
|
1020 CONSOLE_HAS_METHOD (x, font_instance_properties);
|
2527
|
1021 CONSOLE_HAS_METHOD (x, font_list);
|
428
|
1022 #ifdef MULE
|
|
1023 CONSOLE_HAS_METHOD (x, find_charset_font);
|
|
1024 CONSOLE_HAS_METHOD (x, font_spec_matches_charset);
|
|
1025 #endif
|
|
1026 }
|
|
1027
|
|
1028 void
|
|
1029 vars_of_objects_x (void)
|
|
1030 {
|
|
1031 DEFVAR_BOOL ("x-handle-non-fully-specified-fonts",
|
|
1032 &x_handle_non_fully_specified_fonts /*
|
|
1033 If this is true then fonts which do not have all characters specified
|
|
1034 will be considered to be proportional width even if they are actually
|
|
1035 fixed-width. If this is not done then characters which are supposed to
|
|
1036 have 0 width may appear to actually have some width.
|
|
1037
|
|
1038 Note: While setting this to t guarantees correct output in all
|
|
1039 circumstances, it also causes a noticeable performance hit when using
|
|
1040 fixed-width fonts. Since most people don't use characters which could
|
|
1041 cause problems this is set to nil by default.
|
|
1042 */ );
|
|
1043 x_handle_non_fully_specified_fonts = 0;
|
|
1044 }
|
|
1045
|
|
1046 void
|
|
1047 Xatoms_of_objects_x (struct device *d)
|
|
1048 {
|
|
1049 Display *D = DEVICE_X_DISPLAY (d);
|
|
1050
|
|
1051 DEVICE_XATOM_FOUNDRY (d) = XInternAtom (D, "FOUNDRY", False);
|
|
1052 DEVICE_XATOM_FAMILY_NAME (d) = XInternAtom (D, "FAMILY_NAME", False);
|
|
1053 DEVICE_XATOM_WEIGHT_NAME (d) = XInternAtom (D, "WEIGHT_NAME", False);
|
|
1054 DEVICE_XATOM_SLANT (d) = XInternAtom (D, "SLANT", False);
|
|
1055 DEVICE_XATOM_SETWIDTH_NAME (d) = XInternAtom (D, "SETWIDTH_NAME", False);
|
|
1056 DEVICE_XATOM_ADD_STYLE_NAME (d) = XInternAtom (D, "ADD_STYLE_NAME", False);
|
|
1057 DEVICE_XATOM_PIXEL_SIZE (d) = XInternAtom (D, "PIXEL_SIZE", False);
|
|
1058 DEVICE_XATOM_POINT_SIZE (d) = XInternAtom (D, "POINT_SIZE", False);
|
|
1059 DEVICE_XATOM_RESOLUTION_X (d) = XInternAtom (D, "RESOLUTION_X", False);
|
|
1060 DEVICE_XATOM_RESOLUTION_Y (d) = XInternAtom (D, "RESOLUTION_Y", False);
|
|
1061 DEVICE_XATOM_SPACING (d) = XInternAtom (D, "SPACING", False);
|
|
1062 DEVICE_XATOM_AVERAGE_WIDTH (d) = XInternAtom (D, "AVERAGE_WIDTH", False);
|
|
1063 DEVICE_XATOM_CHARSET_REGISTRY(d) = XInternAtom (D, "CHARSET_REGISTRY",False);
|
|
1064 DEVICE_XATOM_CHARSET_ENCODING(d) = XInternAtom (D, "CHARSET_ENCODING",False);
|
|
1065 }
|