0
|
1 /* Generic Objects and Functions.
|
|
2 Copyright (C) 1995 Free Software Foundation, Inc.
|
|
3 Copyright (C) 1995 Board of Trustees, University of Illinois.
|
|
4 Copyright (C) 1995, 1996 Ben Wing.
|
|
5
|
|
6 This file is part of XEmacs.
|
|
7
|
|
8 XEmacs is free software; you can redistribute it and/or modify it
|
|
9 under the terms of the GNU General Public License as published by the
|
|
10 Free Software Foundation; either version 2, or (at your option) any
|
|
11 later version.
|
|
12
|
|
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
16 for more details.
|
|
17
|
|
18 You should have received a copy of the GNU General Public License
|
|
19 along with XEmacs; see the file COPYING. If not, write to
|
|
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
21 Boston, MA 02111-1307, USA. */
|
|
22
|
|
23 /* Synched up with: Not in FSF. */
|
|
24
|
|
25 #include <config.h>
|
|
26 #include "lisp.h"
|
|
27
|
|
28 #include "device.h"
|
|
29 #include "elhash.h"
|
|
30 #include "faces.h"
|
|
31 #include "frame.h"
|
|
32 #include "objects.h"
|
|
33 #include "specifier.h"
|
|
34 #include "window.h"
|
|
35
|
|
36 /* Objects that are substituted when an instantiation fails.
|
|
37 If we leave in the Qunbound value, we will probably get crashes. */
|
|
38 Lisp_Object Vthe_null_color_instance, Vthe_null_font_instance;
|
|
39
|
|
40 /* Authors: Ben Wing, Chuck Thompson */
|
|
41
|
|
42 void
|
|
43 finalose (void *ptr)
|
|
44 {
|
173
|
45 Lisp_Object obj;
|
185
|
46 XSETOBJ (obj, Lisp_Type_Record, ptr);
|
0
|
47
|
|
48 signal_simple_error
|
|
49 ("Can't dump an emacs containing window system objects", obj);
|
|
50 }
|
|
51
|
|
52
|
|
53 /****************************************************************************
|
|
54 * Color-Instance Object *
|
|
55 ****************************************************************************/
|
|
56
|
|
57 Lisp_Object Qcolor_instancep;
|
|
58
|
|
59 static Lisp_Object
|
|
60 mark_color_instance (Lisp_Object obj, void (*markobj) (Lisp_Object))
|
|
61 {
|
|
62 struct Lisp_Color_Instance *c = XCOLOR_INSTANCE (obj);
|
|
63 ((markobj) (c->name));
|
|
64 if (!NILP (c->device)) /* Vthe_null_color_instance */
|
|
65 MAYBE_DEVMETH (XDEVICE (c->device), mark_color_instance, (c, markobj));
|
|
66
|
173
|
67 return c->device;
|
0
|
68 }
|
|
69
|
|
70 static void
|
|
71 print_color_instance (Lisp_Object obj, Lisp_Object printcharfun,
|
|
72 int escapeflag)
|
|
73 {
|
|
74 char buf[100];
|
|
75 struct Lisp_Color_Instance *c = XCOLOR_INSTANCE (obj);
|
|
76 if (print_readably)
|
|
77 error ("printing unreadable object #<color-instance 0x%x>",
|
|
78 c->header.uid);
|
|
79 write_c_string ("#<color-instance ", printcharfun);
|
|
80 print_internal (c->name, printcharfun, 0);
|
|
81 write_c_string (" on ", printcharfun);
|
|
82 print_internal (c->device, printcharfun, 0);
|
|
83 if (!NILP (c->device)) /* Vthe_null_color_instance */
|
|
84 MAYBE_DEVMETH (XDEVICE (c->device), print_color_instance,
|
|
85 (c, printcharfun, escapeflag));
|
|
86 sprintf (buf, " 0x%x>", c->header.uid);
|
|
87 write_c_string (buf, printcharfun);
|
|
88 }
|
|
89
|
|
90 static void
|
|
91 finalize_color_instance (void *header, int for_disksave)
|
|
92 {
|
|
93 struct Lisp_Color_Instance *c = (struct Lisp_Color_Instance *) header;
|
|
94
|
|
95 if (!NILP (c->device))
|
|
96 {
|
|
97 if (for_disksave) finalose (c);
|
|
98 MAYBE_DEVMETH (XDEVICE (c->device), finalize_color_instance, (c));
|
|
99 }
|
|
100 }
|
|
101
|
|
102 static int
|
|
103 color_instance_equal (Lisp_Object o1, Lisp_Object o2, int depth)
|
|
104 {
|
|
105 struct Lisp_Color_Instance *c1 = XCOLOR_INSTANCE (o1);
|
|
106 struct Lisp_Color_Instance *c2 = XCOLOR_INSTANCE (o2);
|
|
107 struct device *d1 = DEVICEP (c1->device) ? XDEVICE (c1->device) : 0;
|
|
108 struct device *d2 = DEVICEP (c2->device) ? XDEVICE (c2->device) : 0;
|
|
109
|
|
110 if (d1 != d2)
|
|
111 return 0;
|
|
112 if (!d1 || !HAS_DEVMETH_P (d1, color_instance_equal))
|
|
113 return EQ (o1, o2);
|
|
114 return DEVMETH (d1, color_instance_equal, (c1, c2, depth));
|
|
115 }
|
|
116
|
|
117 static unsigned long
|
|
118 color_instance_hash (Lisp_Object obj, int depth)
|
|
119 {
|
|
120 struct Lisp_Color_Instance *c = XCOLOR_INSTANCE (obj);
|
|
121 struct device *d = DEVICEP (c->device) ? XDEVICE (c->device) : 0;
|
|
122
|
|
123 return HASH2 ((unsigned long) d,
|
|
124 !d ? LISP_HASH (obj)
|
|
125 : DEVMETH_OR_GIVEN (d, color_instance_hash, (c, depth),
|
|
126 LISP_HASH (obj)));
|
|
127 }
|
|
128
|
272
|
129 DEFINE_LRECORD_IMPLEMENTATION ("color-instance", color_instance,
|
|
130 mark_color_instance, print_color_instance,
|
|
131 finalize_color_instance, color_instance_equal,
|
|
132 color_instance_hash,
|
|
133 struct Lisp_Color_Instance);
|
|
134
|
20
|
135 DEFUN ("make-color-instance", Fmake_color_instance, 1, 3, 0, /*
|
272
|
136 Return a new `color-instance' object named NAME (a string).
|
|
137
|
|
138 Optional argument DEVICE specifies the device this object applies to
|
|
139 and defaults to the selected device.
|
|
140
|
|
141 An error is signaled if the color is unknown or cannot be allocated;
|
|
142 however, if optional argument NO-ERROR is non-nil, nil is simply
|
|
143 returned in this case. (And if NO-ERROR is other than t, a warning may
|
|
144 be issued.)
|
0
|
145
|
|
146 The returned object is a normal, first-class lisp object. The way you
|
|
147 `deallocate' the color is the way you deallocate any other lisp object:
|
|
148 you drop all pointers to it and allow it to be garbage collected. When
|
|
149 these objects are GCed, the underlying window-system data (e.g. X object)
|
|
150 is deallocated as well.
|
20
|
151 */
|
|
152 (name, device, no_error))
|
0
|
153 {
|
|
154 struct Lisp_Color_Instance *c;
|
|
155 Lisp_Object val;
|
272
|
156 int retval;
|
0
|
157
|
|
158 CHECK_STRING (name);
|
|
159 XSETDEVICE (device, decode_device (device));
|
|
160
|
185
|
161 c = alloc_lcrecord_type (struct Lisp_Color_Instance, lrecord_color_instance);
|
0
|
162 c->name = name;
|
|
163 c->device = device;
|
|
164 c->data = 0;
|
|
165
|
|
166 retval = MAYBE_INT_DEVMETH (XDEVICE (device), initialize_color_instance,
|
|
167 (c, name, device,
|
|
168 decode_error_behavior_flag (no_error)));
|
|
169 if (!retval)
|
|
170 return Qnil;
|
|
171
|
|
172 XSETCOLOR_INSTANCE (val, c);
|
|
173 return val;
|
|
174 }
|
|
175
|
20
|
176 DEFUN ("color-instance-p", Fcolor_instance_p, 1, 1, 0, /*
|
0
|
177 Return non-nil if OBJECT is a color instance.
|
20
|
178 */
|
|
179 (object))
|
0
|
180 {
|
173
|
181 return COLOR_INSTANCEP (object) ? Qt : Qnil;
|
0
|
182 }
|
|
183
|
20
|
184 DEFUN ("color-instance-name", Fcolor_instance_name, 1, 1, 0, /*
|
0
|
185 Return the name used to allocate COLOR-INSTANCE.
|
20
|
186 */
|
|
187 (color_instance))
|
0
|
188 {
|
|
189 CHECK_COLOR_INSTANCE (color_instance);
|
173
|
190 return XCOLOR_INSTANCE (color_instance)->name;
|
0
|
191 }
|
|
192
|
20
|
193 DEFUN ("color-instance-rgb-components", Fcolor_instance_rgb_components, 1, 1, 0, /*
|
0
|
194 Return a three element list containing the red, green, and blue
|
|
195 color components of COLOR-INSTANCE, or nil if unknown.
|
272
|
196 Component values range from 0 to 65535.
|
20
|
197 */
|
|
198 (color_instance))
|
0
|
199 {
|
|
200 struct Lisp_Color_Instance *c;
|
|
201
|
|
202 CHECK_COLOR_INSTANCE (color_instance);
|
|
203 c = XCOLOR_INSTANCE (color_instance);
|
|
204
|
|
205 if (NILP (c->device))
|
|
206 return Qnil;
|
272
|
207
|
|
208 return MAYBE_LISP_DEVMETH (XDEVICE (c->device),
|
|
209 color_instance_rgb_components,
|
|
210 (c));
|
0
|
211 }
|
|
212
|
20
|
213 DEFUN ("valid-color-name-p", Fvalid_color_name_p, 1, 2, 0, /*
|
0
|
214 Return true if COLOR names a valid color for the current device.
|
|
215
|
|
216 Valid color names for X are listed in the file /usr/lib/X11/rgb.txt, or
|
|
217 whatever the equivalent is on your system.
|
|
218
|
|
219 Valid color names for TTY are those which have an ISO 6429 (ANSI) sequence.
|
|
220 In addition to being a color this may be one of a number of attributes
|
|
221 such as `blink'.
|
20
|
222 */
|
|
223 (color, device))
|
0
|
224 {
|
|
225 struct device *d = decode_device (device);
|
|
226
|
|
227 CHECK_STRING (color);
|
|
228 return MAYBE_INT_DEVMETH (d, valid_color_name_p, (d, color)) ? Qt : Qnil;
|
|
229 }
|
|
230
|
|
231
|
|
232 /***************************************************************************
|
|
233 * Font-Instance Object *
|
|
234 ***************************************************************************/
|
|
235
|
|
236 Lisp_Object Qfont_instancep;
|
|
237
|
|
238 static Lisp_Object font_instance_truename_internal (Lisp_Object xfont,
|
|
239 Error_behavior errb);
|
|
240
|
|
241 static Lisp_Object
|
|
242 mark_font_instance (Lisp_Object obj, void (*markobj) (Lisp_Object))
|
|
243 {
|
|
244 struct Lisp_Font_Instance *f = XFONT_INSTANCE (obj);
|
|
245
|
|
246 ((markobj) (f->name));
|
|
247 if (!NILP (f->device)) /* Vthe_null_font_instance */
|
|
248 MAYBE_DEVMETH (XDEVICE (f->device), mark_font_instance, (f, markobj));
|
|
249
|
|
250 return f->device;
|
|
251 }
|
|
252
|
|
253 static void
|
|
254 print_font_instance (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
|
|
255 {
|
|
256 char buf[200];
|
|
257 struct Lisp_Font_Instance *f = XFONT_INSTANCE (obj);
|
|
258 if (print_readably)
|
|
259 error ("printing unreadable object #<font-instance 0x%x>", f->header.uid);
|
|
260 write_c_string ("#<font-instance ", printcharfun);
|
|
261 print_internal (f->name, printcharfun, 1);
|
|
262 write_c_string (" on ", printcharfun);
|
|
263 print_internal (f->device, printcharfun, 0);
|
343
|
264 if (!NILP (f->device))
|
|
265 MAYBE_DEVMETH (XDEVICE (f->device), print_font_instance,
|
|
266 (f, printcharfun, escapeflag));
|
0
|
267 sprintf (buf, " 0x%x>", f->header.uid);
|
|
268 write_c_string (buf, printcharfun);
|
|
269 }
|
|
270
|
|
271 static void
|
|
272 finalize_font_instance (void *header, int for_disksave)
|
|
273 {
|
|
274 struct Lisp_Font_Instance *f = (struct Lisp_Font_Instance *) header;
|
|
275
|
|
276 if (!NILP (f->device))
|
|
277 {
|
|
278 if (for_disksave) finalose (f);
|
|
279 MAYBE_DEVMETH (XDEVICE (f->device), finalize_font_instance, (f));
|
|
280 }
|
|
281 }
|
|
282
|
|
283 /* Fonts are equal if they resolve to the same name.
|
|
284 Since we call `font-truename' to do this, and since font-truename is lazy,
|
|
285 this means the `equal' could cause XListFonts to be run the first time.
|
|
286 */
|
|
287 static int
|
|
288 font_instance_equal (Lisp_Object o1, Lisp_Object o2, int depth)
|
|
289 {
|
|
290 /* #### should this be moved into a device method? */
|
173
|
291 return internal_equal (font_instance_truename_internal (o1, ERROR_ME_NOT),
|
|
292 font_instance_truename_internal (o2, ERROR_ME_NOT),
|
|
293 depth + 1);
|
0
|
294 }
|
|
295
|
|
296 static unsigned long
|
|
297 font_instance_hash (Lisp_Object obj, int depth)
|
|
298 {
|
|
299 return internal_hash (font_instance_truename_internal (obj, ERROR_ME_NOT),
|
|
300 depth + 1);
|
|
301 }
|
|
302
|
272
|
303 DEFINE_LRECORD_IMPLEMENTATION ("font-instance", font_instance,
|
|
304 mark_font_instance, print_font_instance,
|
|
305 finalize_font_instance, font_instance_equal,
|
|
306 font_instance_hash, struct Lisp_Font_Instance);
|
|
307
|
20
|
308 DEFUN ("make-font-instance", Fmake_font_instance, 1, 3, 0, /*
|
272
|
309 Return a new `font-instance' object named NAME.
|
0
|
310 DEVICE specifies the device this object applies to and defaults to the
|
|
311 selected device. An error is signalled if the font is unknown or cannot
|
|
312 be allocated; however, if NOERROR is non-nil, nil is simply returned in
|
|
313 this case.
|
|
314
|
|
315 The returned object is a normal, first-class lisp object. The way you
|
|
316 `deallocate' the font is the way you deallocate any other lisp object:
|
|
317 you drop all pointers to it and allow it to be garbage collected. When
|
|
318 these objects are GCed, the underlying X data is deallocated as well.
|
20
|
319 */
|
|
320 (name, device, no_error))
|
0
|
321 {
|
|
322 struct Lisp_Font_Instance *f;
|
|
323 Lisp_Object val;
|
|
324 int retval = 0;
|
|
325 Error_behavior errb = decode_error_behavior_flag (no_error);
|
|
326
|
|
327 if (ERRB_EQ (errb, ERROR_ME))
|
|
328 CHECK_STRING (name);
|
|
329 else if (!STRINGP (name))
|
|
330 return Qnil;
|
|
331
|
|
332 XSETDEVICE (device, decode_device (device));
|
|
333
|
185
|
334 f = alloc_lcrecord_type (struct Lisp_Font_Instance, lrecord_font_instance);
|
0
|
335 f->name = name;
|
|
336 f->device = device;
|
|
337
|
|
338 f->data = 0;
|
|
339
|
|
340 /* Stick some default values here ... */
|
|
341 f->ascent = f->height = 1;
|
|
342 f->descent = 0;
|
|
343 f->width = 1;
|
|
344 f->proportional_p = 0;
|
173
|
345
|
0
|
346 retval = MAYBE_INT_DEVMETH (XDEVICE (device), initialize_font_instance,
|
|
347 (f, name, device, errb));
|
|
348
|
|
349 if (!retval)
|
|
350 return Qnil;
|
|
351
|
|
352 XSETFONT_INSTANCE (val, f);
|
|
353 return val;
|
|
354 }
|
|
355
|
20
|
356 DEFUN ("font-instance-p", Ffont_instance_p, 1, 1, 0, /*
|
0
|
357 Return non-nil if OBJECT is a font instance.
|
20
|
358 */
|
|
359 (object))
|
0
|
360 {
|
173
|
361 return FONT_INSTANCEP (object) ? Qt : Qnil;
|
0
|
362 }
|
|
363
|
20
|
364 DEFUN ("font-instance-name", Ffont_instance_name, 1, 1, 0, /*
|
0
|
365 Return the name used to allocate FONT-INSTANCE.
|
20
|
366 */
|
|
367 (font_instance))
|
0
|
368 {
|
|
369 CHECK_FONT_INSTANCE (font_instance);
|
173
|
370 return XFONT_INSTANCE (font_instance)->name;
|
0
|
371 }
|
|
372
|
20
|
373 DEFUN ("font-instance-ascent", Ffont_instance_ascent, 1, 1, 0, /*
|
0
|
374 Return the ascent in pixels of FONT-INSTANCE.
|
|
375 The returned value is the maximum ascent for all characters in the font,
|
|
376 where a character's ascent is the number of pixels above (and including)
|
|
377 the baseline.
|
20
|
378 */
|
|
379 (font_instance))
|
0
|
380 {
|
|
381 CHECK_FONT_INSTANCE (font_instance);
|
|
382 return make_int (XFONT_INSTANCE (font_instance)->ascent);
|
|
383 }
|
|
384
|
20
|
385 DEFUN ("font-instance-descent", Ffont_instance_descent, 1, 1, 0, /*
|
0
|
386 Return the descent in pixels of FONT-INSTANCE.
|
|
387 The returned value is the maximum descent for all characters in the font,
|
|
388 where a character's descent is the number of pixels below the baseline.
|
272
|
389 \(Many characters to do not have any descent. Typical characters with a
|
0
|
390 descent are lowercase p and lowercase g.)
|
20
|
391 */
|
|
392 (font_instance))
|
0
|
393 {
|
|
394 CHECK_FONT_INSTANCE (font_instance);
|
|
395 return make_int (XFONT_INSTANCE (font_instance)->descent);
|
|
396 }
|
|
397
|
20
|
398 DEFUN ("font-instance-width", Ffont_instance_width, 1, 1, 0, /*
|
0
|
399 Return the width in pixels of FONT-INSTANCE.
|
|
400 The returned value is the average width for all characters in the font.
|
20
|
401 */
|
|
402 (font_instance))
|
0
|
403 {
|
|
404 CHECK_FONT_INSTANCE (font_instance);
|
|
405 return make_int (XFONT_INSTANCE (font_instance)->width);
|
|
406 }
|
|
407
|
20
|
408 DEFUN ("font-instance-proportional-p", Ffont_instance_proportional_p, 1, 1, 0, /*
|
0
|
409 Return whether FONT-INSTANCE is proportional.
|
|
410 This means that different characters in the font have different widths.
|
20
|
411 */
|
|
412 (font_instance))
|
0
|
413 {
|
|
414 CHECK_FONT_INSTANCE (font_instance);
|
173
|
415 return XFONT_INSTANCE (font_instance)->proportional_p ? Qt : Qnil;
|
0
|
416 }
|
|
417
|
|
418 static Lisp_Object
|
|
419 font_instance_truename_internal (Lisp_Object font_instance,
|
|
420 Error_behavior errb)
|
|
421 {
|
|
422 struct Lisp_Font_Instance *f = XFONT_INSTANCE (font_instance);
|
343
|
423
|
|
424 if (NILP (f->device))
|
|
425 {
|
|
426 maybe_signal_simple_error ("Couldn't determine font truename",
|
|
427 font_instance, Qfont, errb);
|
|
428 return Qnil;
|
|
429 }
|
|
430
|
|
431 return DEVMETH_OR_GIVEN (XDEVICE (f->device),
|
|
432 font_instance_truename, (f, errb), f->name);
|
0
|
433 }
|
|
434
|
20
|
435 DEFUN ("font-instance-truename", Ffont_instance_truename, 1, 1, 0, /*
|
0
|
436 Return the canonical name of FONT-INSTANCE.
|
|
437 Font names are patterns which may match any number of fonts, of which
|
|
438 the first found is used. This returns an unambiguous name for that font
|
272
|
439 \(but not necessarily its only unambiguous name).
|
20
|
440 */
|
|
441 (font_instance))
|
0
|
442 {
|
|
443 CHECK_FONT_INSTANCE (font_instance);
|
|
444 return font_instance_truename_internal (font_instance, ERROR_ME);
|
|
445 }
|
|
446
|
20
|
447 DEFUN ("font-instance-properties", Ffont_instance_properties, 1, 1, 0, /*
|
0
|
448 Return the properties (an alist or nil) of FONT-INSTANCE.
|
20
|
449 */
|
|
450 (font_instance))
|
0
|
451 {
|
|
452 struct Lisp_Font_Instance *f;
|
|
453
|
|
454 CHECK_FONT_INSTANCE (font_instance);
|
|
455 f = XFONT_INSTANCE (font_instance);
|
|
456
|
343
|
457 if (NILP (f->device))
|
|
458 return Qnil;
|
|
459
|
0
|
460 return MAYBE_LISP_DEVMETH (XDEVICE (f->device),
|
|
461 font_instance_properties, (f));
|
|
462 }
|
|
463
|
20
|
464 DEFUN ("list-fonts", Flist_fonts, 1, 2, 0, /*
|
0
|
465 Return a list of font names matching the given pattern.
|
|
466 DEVICE specifies which device to search for names, and defaults to the
|
|
467 currently selected device.
|
20
|
468 */
|
|
469 (pattern, device))
|
0
|
470 {
|
|
471 CHECK_STRING (pattern);
|
|
472 XSETDEVICE (device, decode_device (device));
|
|
473
|
|
474 return MAYBE_LISP_DEVMETH (XDEVICE (device), list_fonts, (pattern, device));
|
|
475 }
|
|
476
|
|
477
|
|
478 /****************************************************************************
|
|
479 Color Object
|
|
480 ***************************************************************************/
|
|
481 DEFINE_SPECIFIER_TYPE (color);
|
|
482 /* Qcolor defined in general.c */
|
|
483
|
|
484 static void
|
|
485 color_create (Lisp_Object obj)
|
|
486 {
|
|
487 struct Lisp_Specifier *color = XCOLOR_SPECIFIER (obj);
|
|
488
|
|
489 COLOR_SPECIFIER_FACE (color) = Qnil;
|
|
490 COLOR_SPECIFIER_FACE_PROPERTY (color) = Qnil;
|
|
491 }
|
|
492
|
|
493 static void
|
|
494 color_mark (Lisp_Object obj, void (*markobj) (Lisp_Object))
|
|
495 {
|
|
496 struct Lisp_Specifier *color = XCOLOR_SPECIFIER (obj);
|
|
497
|
|
498 ((markobj) (COLOR_SPECIFIER_FACE (color)));
|
|
499 ((markobj) (COLOR_SPECIFIER_FACE_PROPERTY (color)));
|
|
500 }
|
|
501
|
|
502 /* No equal or hash methods; ignore the face the color is based off
|
|
503 of for `equal' */
|
|
504
|
|
505 static Lisp_Object
|
|
506 color_instantiate (Lisp_Object specifier, Lisp_Object matchspec,
|
|
507 Lisp_Object domain, Lisp_Object instantiator,
|
|
508 Lisp_Object depth)
|
|
509 {
|
|
510 /* When called, we're inside of call_with_suspended_errors(),
|
|
511 so we can freely error. */
|
|
512 Lisp_Object device = DFW_DEVICE (domain);
|
|
513 struct device *d = XDEVICE (device);
|
|
514 Lisp_Object instance;
|
|
515
|
|
516 if (COLOR_INSTANCEP (instantiator))
|
|
517 {
|
|
518 /* If we are on the same device then we're done. Otherwise change
|
|
519 the instantiator to the name used to generate the pixel and let the
|
|
520 STRINGP case deal with it. */
|
|
521 if (NILP (device) /* Vthe_null_color_instance */
|
|
522 || EQ (device, XCOLOR_INSTANCE (instantiator)->device))
|
|
523 return instantiator;
|
|
524 else
|
|
525 instantiator = Fcolor_instance_name (instantiator);
|
|
526 }
|
|
527
|
|
528 if (STRINGP (instantiator))
|
|
529 {
|
|
530 /* First, look to see if we can retrieve a cached value. */
|
|
531 instance = Fgethash (instantiator, d->color_instance_cache, Qunbound);
|
|
532 /* Otherwise, make a new one. */
|
|
533 if (UNBOUNDP (instance))
|
|
534 {
|
|
535 /* make sure we cache the failures, too. */
|
|
536 instance = Fmake_color_instance (instantiator, device, Qt);
|
|
537 Fputhash (instantiator, instance, d->color_instance_cache);
|
|
538 }
|
|
539
|
173
|
540 return NILP (instance) ? Qunbound : instance;
|
0
|
541 }
|
|
542 else if (VECTORP (instantiator))
|
|
543 {
|
173
|
544 switch (XVECTOR_LENGTH (instantiator))
|
0
|
545 {
|
|
546 case 0:
|
|
547 if (DEVICE_TTY_P (d))
|
|
548 return Vthe_null_color_instance;
|
|
549 else
|
|
550 signal_simple_error ("Color instantiator [] only valid on TTY's",
|
|
551 device);
|
|
552
|
|
553 case 1:
|
|
554 if (NILP (COLOR_SPECIFIER_FACE (XCOLOR_SPECIFIER (specifier))))
|
|
555 signal_simple_error ("Color specifier not attached to a face",
|
|
556 instantiator);
|
|
557 return (FACE_PROPERTY_INSTANCE_1
|
173
|
558 (Fget_face (XVECTOR_DATA (instantiator)[0]),
|
|
559 COLOR_SPECIFIER_FACE_PROPERTY (XCOLOR_SPECIFIER (specifier)),
|
|
560 domain, ERROR_ME, 0, depth));
|
0
|
561
|
|
562 case 2:
|
|
563 return (FACE_PROPERTY_INSTANCE_1
|
173
|
564 (Fget_face (XVECTOR_DATA (instantiator)[0]),
|
|
565 XVECTOR_DATA (instantiator)[1], domain, ERROR_ME, 0, depth));
|
0
|
566
|
|
567 default:
|
|
568 abort ();
|
|
569 }
|
|
570 }
|
|
571 else if (NILP (instantiator))
|
|
572 {
|
|
573 if (DEVICE_TTY_P (d))
|
|
574 return Vthe_null_color_instance;
|
|
575 else
|
|
576 signal_simple_error ("Color instantiator [] only valid on TTY's",
|
|
577 device);
|
|
578 }
|
|
579 else
|
|
580 abort (); /* The spec validation routines are screwed up. */
|
|
581
|
|
582 return Qunbound;
|
|
583 }
|
|
584
|
|
585 static void
|
|
586 color_validate (Lisp_Object instantiator)
|
|
587 {
|
|
588 if (COLOR_INSTANCEP (instantiator) || STRINGP (instantiator))
|
|
589 return;
|
|
590 if (VECTORP (instantiator))
|
|
591 {
|
173
|
592 if (XVECTOR_LENGTH (instantiator) > 2)
|
0
|
593 signal_simple_error ("Inheritance vector must be of size 0 - 2",
|
|
594 instantiator);
|
173
|
595 else if (XVECTOR_LENGTH (instantiator) > 0)
|
0
|
596 {
|
173
|
597 Lisp_Object face = XVECTOR_DATA (instantiator)[0];
|
|
598
|
0
|
599 Fget_face (face);
|
173
|
600 if (XVECTOR_LENGTH (instantiator) == 2)
|
0
|
601 {
|
173
|
602 Lisp_Object field = XVECTOR_DATA (instantiator)[1];
|
0
|
603 if (!EQ (field, Qforeground) && !EQ (field, Qbackground))
|
|
604 signal_simple_error
|
|
605 ("Inheritance field must be `foreground' or `background'",
|
|
606 field);
|
|
607 }
|
|
608 }
|
|
609 }
|
|
610 else
|
|
611 signal_simple_error ("Invalid color instantiator", instantiator);
|
|
612 }
|
|
613
|
|
614 static void
|
|
615 color_after_change (Lisp_Object specifier, Lisp_Object locale)
|
|
616 {
|
|
617 Lisp_Object face = COLOR_SPECIFIER_FACE (XCOLOR_SPECIFIER (specifier));
|
|
618 Lisp_Object property =
|
|
619 COLOR_SPECIFIER_FACE_PROPERTY (XCOLOR_SPECIFIER (specifier));
|
|
620 if (!NILP (face))
|
|
621 face_property_was_changed (face, property, locale);
|
|
622 }
|
|
623
|
|
624 void
|
|
625 set_color_attached_to (Lisp_Object obj, Lisp_Object face, Lisp_Object property)
|
|
626 {
|
|
627 struct Lisp_Specifier *color = XCOLOR_SPECIFIER (obj);
|
|
628
|
|
629 COLOR_SPECIFIER_FACE (color) = face;
|
|
630 COLOR_SPECIFIER_FACE_PROPERTY (color) = property;
|
|
631 }
|
|
632
|
20
|
633 DEFUN ("color-specifier-p", Fcolor_specifier_p, 1, 1, 0, /*
|
272
|
634 Return t if OBJECT is a color specifier.
|
0
|
635
|
|
636 Valid instantiators for color specifiers are:
|
|
637
|
185
|
638 -- a string naming a color (e.g. under X this might be "lightseagreen2"
|
|
639 or "#F534B2")
|
0
|
640 -- a color instance (use that instance directly if the device matches,
|
|
641 or use the string that generated it)
|
|
642 -- a vector of no elements (only on TTY's; this means to set no color
|
185
|
643 at all, thus using the "natural" color of the terminal's text)
|
0
|
644 -- a vector of one or two elements: a face to inherit from, and
|
|
645 optionally a symbol naming which property of that face to inherit,
|
|
646 either `foreground' or `background' (if omitted, defaults to the same
|
|
647 property that this color specifier is used for; if this specifier is
|
|
648 not part of a face, the instantiator would not be valid)
|
20
|
649 */
|
|
650 (object))
|
0
|
651 {
|
173
|
652 return COLOR_SPECIFIERP (object) ? Qt : Qnil;
|
0
|
653 }
|
|
654
|
|
655
|
|
656 /****************************************************************************
|
|
657 Font Object
|
|
658 ***************************************************************************/
|
|
659 DEFINE_SPECIFIER_TYPE (font);
|
|
660 /* Qfont defined in general.c */
|
|
661
|
|
662 static void
|
|
663 font_create (Lisp_Object obj)
|
|
664 {
|
|
665 struct Lisp_Specifier *font = XFONT_SPECIFIER (obj);
|
|
666
|
|
667 FONT_SPECIFIER_FACE (font) = Qnil;
|
|
668 FONT_SPECIFIER_FACE_PROPERTY (font) = Qnil;
|
|
669 }
|
|
670
|
|
671 static void
|
|
672 font_mark (Lisp_Object obj, void (*markobj) (Lisp_Object))
|
|
673 {
|
|
674 struct Lisp_Specifier *font = XFONT_SPECIFIER (obj);
|
|
675
|
|
676 ((markobj) (FONT_SPECIFIER_FACE (font)));
|
|
677 ((markobj) (FONT_SPECIFIER_FACE_PROPERTY (font)));
|
|
678 }
|
|
679
|
|
680 /* No equal or hash methods; ignore the face the font is based off
|
|
681 of for `equal' */
|
70
|
682
|
|
683 #ifdef MULE
|
|
684
|
|
685 int
|
|
686 font_spec_matches_charset (struct device *d, Lisp_Object charset,
|
|
687 CONST Bufbyte *nonreloc, Lisp_Object reloc,
|
|
688 Bytecount offset, Bytecount length)
|
|
689 {
|
|
690 return DEVMETH_OR_GIVEN (d, font_spec_matches_charset,
|
|
691 (d, charset, nonreloc, reloc, offset, length),
|
|
692 1);
|
|
693 }
|
|
694
|
|
695 static void
|
|
696 font_validate_matchspec (Lisp_Object matchspec)
|
|
697 {
|
|
698 Fget_charset (matchspec);
|
|
699 }
|
|
700
|
|
701 #endif /* MULE */
|
|
702
|
|
703
|
0
|
704 static Lisp_Object
|
|
705 font_instantiate (Lisp_Object specifier, Lisp_Object matchspec,
|
|
706 Lisp_Object domain, Lisp_Object instantiator,
|
|
707 Lisp_Object depth)
|
|
708 {
|
|
709 /* When called, we're inside of call_with_suspended_errors(),
|
|
710 so we can freely error. */
|
|
711 Lisp_Object device = DFW_DEVICE (domain);
|
|
712 struct device *d = XDEVICE (device);
|
|
713 Lisp_Object instance;
|
|
714
|
70
|
715 #ifdef MULE
|
|
716 if (!UNBOUNDP (matchspec))
|
|
717 matchspec = Fget_charset (matchspec);
|
|
718 #endif
|
|
719
|
0
|
720 if (FONT_INSTANCEP (instantiator))
|
|
721 {
|
70
|
722 if (NILP (device)
|
0
|
723 || EQ (device, XFONT_INSTANCE (instantiator)->device))
|
|
724 {
|
70
|
725 #ifdef MULE
|
|
726 if (font_spec_matches_charset (d, matchspec, 0,
|
|
727 Ffont_instance_truename
|
|
728 (instantiator),
|
|
729 0, -1))
|
|
730 return instantiator;
|
|
731 #else
|
0
|
732 return instantiator;
|
70
|
733 #endif
|
0
|
734 }
|
|
735 instantiator = Ffont_instance_name (instantiator);
|
|
736 }
|
173
|
737
|
2
|
738 if (STRINGP (instantiator))
|
0
|
739 {
|
70
|
740 #ifdef MULE
|
|
741 if (!UNBOUNDP (matchspec))
|
|
742 {
|
|
743 /* The instantiator is a font spec that could match many
|
|
744 different fonts. We need to find one of those fonts
|
|
745 whose registry matches the registry of the charset in
|
|
746 MATCHSPEC. This is potentially a very slow operation,
|
|
747 as it involves doing an XListFonts() or equivalent to
|
|
748 iterate over all possible fonts, and a regexp match
|
|
749 on each one. So we cache the results. */
|
|
750 Lisp_Object matching_font = Qunbound;
|
|
751 Lisp_Object hashtab = Fgethash (matchspec, d->charset_font_cache,
|
|
752 Qunbound);
|
|
753 if (UNBOUNDP (hashtab))
|
|
754 {
|
|
755 /* need to make a sub hash table. */
|
|
756 hashtab = make_lisp_hashtable (20, HASHTABLE_KEY_WEAK,
|
|
757 HASHTABLE_EQUAL);
|
|
758 Fputhash (matchspec, hashtab, d->charset_font_cache);
|
|
759 }
|
|
760 else
|
|
761 matching_font = Fgethash (instantiator, hashtab, Qunbound);
|
|
762
|
|
763 if (UNBOUNDP (matching_font))
|
|
764 {
|
|
765 /* make sure we cache the failures, too. */
|
|
766 matching_font =
|
|
767 DEVMETH_OR_GIVEN (d, find_charset_font,
|
|
768 (device, instantiator, matchspec),
|
|
769 instantiator);
|
|
770 Fputhash (instantiator, matching_font, hashtab);
|
|
771 }
|
|
772 if (NILP (matching_font))
|
|
773 return Qunbound;
|
|
774 instantiator = matching_font;
|
|
775 }
|
|
776 #endif /* MULE */
|
|
777
|
0
|
778 /* First, look to see if we can retrieve a cached value. */
|
|
779 instance = Fgethash (instantiator, d->font_instance_cache, Qunbound);
|
|
780 /* Otherwise, make a new one. */
|
|
781 if (UNBOUNDP (instance))
|
|
782 {
|
|
783 /* make sure we cache the failures, too. */
|
|
784 instance = Fmake_font_instance (instantiator, device, Qt);
|
|
785 Fputhash (instantiator, instance, d->font_instance_cache);
|
|
786 }
|
|
787
|
173
|
788 return NILP (instance) ? Qunbound : instance;
|
0
|
789 }
|
|
790 else if (VECTORP (instantiator))
|
|
791 {
|
173
|
792 assert (XVECTOR_LENGTH (instantiator) == 1);
|
0
|
793 return (face_property_matching_instance
|
173
|
794 (Fget_face (XVECTOR_DATA (instantiator)[0]), Qfont,
|
0
|
795 matchspec, domain, ERROR_ME, 0, depth));
|
|
796 }
|
|
797 else if (NILP (instantiator))
|
|
798 return Qunbound;
|
|
799 else
|
|
800 abort (); /* Eh? */
|
|
801
|
|
802 return Qunbound;
|
|
803 }
|
|
804
|
|
805 static void
|
|
806 font_validate (Lisp_Object instantiator)
|
|
807 {
|
|
808 if (FONT_INSTANCEP (instantiator) || STRINGP (instantiator))
|
|
809 return;
|
|
810 if (VECTORP (instantiator))
|
|
811 {
|
173
|
812 if (XVECTOR_LENGTH (instantiator) != 1)
|
0
|
813 {
|
|
814 signal_simple_error
|
|
815 ("Vector length must be one for font inheritance", instantiator);
|
|
816 }
|
173
|
817 Fget_face (XVECTOR_DATA (instantiator)[0]);
|
0
|
818 }
|
|
819 else
|
|
820 signal_simple_error ("Must be string, vector, or font-instance",
|
|
821 instantiator);
|
|
822 }
|
|
823
|
|
824 static void
|
|
825 font_after_change (Lisp_Object specifier, Lisp_Object locale)
|
|
826 {
|
|
827 Lisp_Object face = FONT_SPECIFIER_FACE (XFONT_SPECIFIER (specifier));
|
|
828 Lisp_Object property =
|
|
829 FONT_SPECIFIER_FACE_PROPERTY (XFONT_SPECIFIER (specifier));
|
|
830 if (!NILP (face))
|
|
831 face_property_was_changed (face, property, locale);
|
|
832 }
|
|
833
|
|
834 void
|
|
835 set_font_attached_to (Lisp_Object obj, Lisp_Object face, Lisp_Object property)
|
|
836 {
|
|
837 struct Lisp_Specifier *font = XFONT_SPECIFIER (obj);
|
|
838
|
|
839 FONT_SPECIFIER_FACE (font) = face;
|
|
840 FONT_SPECIFIER_FACE_PROPERTY (font) = property;
|
|
841 }
|
|
842
|
20
|
843 DEFUN ("font-specifier-p", Ffont_specifier_p, 1, 1, 0, /*
|
0
|
844 Return non-nil if OBJECT is a font specifier.
|
|
845
|
|
846 Valid instantiators for font specifiers are:
|
|
847
|
|
848 -- a string naming a font (e.g. under X this might be
|
185
|
849 "-*-courier-medium-r-*-*-*-140-*-*-*-*-iso8859-*" for a 14-point
|
0
|
850 upright medium-weight Courier font)
|
|
851 -- a font instance (use that instance directly if the device matches,
|
|
852 or use the string that generated it)
|
|
853 -- a vector of no elements (only on TTY's; this means to set no font
|
185
|
854 at all, thus using the "natural" font of the terminal's text)
|
0
|
855 -- a vector of one element (a face to inherit from)
|
20
|
856 */
|
|
857 (object))
|
0
|
858 {
|
173
|
859 return FONT_SPECIFIERP (object) ? Qt : Qnil;
|
0
|
860 }
|
|
861
|
|
862
|
|
863 /*****************************************************************************
|
|
864 Face Boolean Object
|
|
865 ****************************************************************************/
|
|
866 DEFINE_SPECIFIER_TYPE (face_boolean);
|
|
867 Lisp_Object Qface_boolean;
|
|
868
|
|
869 static void
|
|
870 face_boolean_create (Lisp_Object obj)
|
|
871 {
|
|
872 struct Lisp_Specifier *face_boolean = XFACE_BOOLEAN_SPECIFIER (obj);
|
|
873
|
|
874 FACE_BOOLEAN_SPECIFIER_FACE (face_boolean) = Qnil;
|
|
875 FACE_BOOLEAN_SPECIFIER_FACE_PROPERTY (face_boolean) = Qnil;
|
|
876 }
|
|
877
|
|
878 static void
|
|
879 face_boolean_mark (Lisp_Object obj, void (*markobj) (Lisp_Object))
|
|
880 {
|
|
881 struct Lisp_Specifier *face_boolean = XFACE_BOOLEAN_SPECIFIER (obj);
|
|
882
|
|
883 ((markobj) (FACE_BOOLEAN_SPECIFIER_FACE (face_boolean)));
|
|
884 ((markobj) (FACE_BOOLEAN_SPECIFIER_FACE_PROPERTY (face_boolean)));
|
|
885 }
|
|
886
|
|
887 /* No equal or hash methods; ignore the face the face-boolean is based off
|
|
888 of for `equal' */
|
|
889
|
|
890 static Lisp_Object
|
|
891 face_boolean_instantiate (Lisp_Object specifier, Lisp_Object matchspec,
|
|
892 Lisp_Object domain, Lisp_Object instantiator,
|
|
893 Lisp_Object depth)
|
|
894 {
|
|
895 /* When called, we're inside of call_with_suspended_errors(),
|
|
896 so we can freely error. */
|
|
897 if (NILP (instantiator) || EQ (instantiator, Qt))
|
|
898 return instantiator;
|
|
899 else if (VECTORP (instantiator))
|
|
900 {
|
|
901 Lisp_Object retval;
|
|
902 Lisp_Object prop;
|
173
|
903 int instantiator_len = XVECTOR_LENGTH (instantiator);
|
0
|
904
|
173
|
905 assert (instantiator_len >= 1 && instantiator_len <= 3);
|
|
906 if (instantiator_len > 1)
|
|
907 prop = XVECTOR_DATA (instantiator)[1];
|
0
|
908 else
|
|
909 {
|
|
910 if (NILP (FACE_BOOLEAN_SPECIFIER_FACE
|
|
911 (XFACE_BOOLEAN_SPECIFIER (specifier))))
|
|
912 signal_simple_error
|
|
913 ("Face-boolean specifier not attached to a face", instantiator);
|
|
914 prop = FACE_BOOLEAN_SPECIFIER_FACE_PROPERTY
|
|
915 (XFACE_BOOLEAN_SPECIFIER (specifier));
|
|
916 }
|
|
917
|
|
918 retval = (FACE_PROPERTY_INSTANCE_1
|
173
|
919 (Fget_face (XVECTOR_DATA (instantiator)[0]),
|
0
|
920 prop, domain, ERROR_ME, 0, depth));
|
|
921
|
173
|
922 if (instantiator_len == 3 && !NILP (XVECTOR_DATA (instantiator)[2]))
|
|
923 retval = NILP (retval) ? Qt : Qnil;
|
0
|
924
|
|
925 return retval;
|
|
926 }
|
|
927 else
|
|
928 abort (); /* Eh? */
|
|
929
|
|
930 return Qunbound;
|
|
931 }
|
|
932
|
|
933 static void
|
|
934 face_boolean_validate (Lisp_Object instantiator)
|
|
935 {
|
|
936 if (NILP (instantiator) || EQ (instantiator, Qt))
|
|
937 return;
|
|
938 else if (VECTORP (instantiator) &&
|
173
|
939 (XVECTOR_LENGTH (instantiator) >= 1 &&
|
|
940 XVECTOR_LENGTH (instantiator) <= 3))
|
0
|
941 {
|
173
|
942 Lisp_Object face = XVECTOR_DATA (instantiator)[0];
|
|
943
|
0
|
944 Fget_face (face);
|
|
945
|
173
|
946 if (XVECTOR_LENGTH (instantiator) > 1)
|
0
|
947 {
|
173
|
948 Lisp_Object field = XVECTOR_DATA (instantiator)[1];
|
0
|
949 if (!EQ (field, Qunderline)
|
|
950 && !EQ (field, Qstrikethru)
|
|
951 && !EQ (field, Qhighlight)
|
|
952 && !EQ (field, Qdim)
|
|
953 && !EQ (field, Qblinking)
|
|
954 && !EQ (field, Qreverse))
|
|
955 signal_simple_error ("Invalid face-boolean inheritance field",
|
|
956 field);
|
|
957 }
|
|
958 }
|
|
959 else if (VECTORP (instantiator))
|
|
960 signal_simple_error ("Wrong length for face-boolean inheritance spec",
|
|
961 instantiator);
|
|
962 else
|
|
963 signal_simple_error ("Face-boolean instantiator must be nil, t, or vector",
|
|
964 instantiator);
|
|
965 }
|
|
966
|
|
967 static void
|
|
968 face_boolean_after_change (Lisp_Object specifier, Lisp_Object locale)
|
|
969 {
|
|
970 Lisp_Object face =
|
|
971 FACE_BOOLEAN_SPECIFIER_FACE (XFACE_BOOLEAN_SPECIFIER (specifier));
|
|
972 Lisp_Object property =
|
|
973 FACE_BOOLEAN_SPECIFIER_FACE_PROPERTY (XFACE_BOOLEAN_SPECIFIER (specifier));
|
|
974 if (!NILP (face))
|
|
975 face_property_was_changed (face, property, locale);
|
|
976 }
|
|
977
|
|
978 void
|
|
979 set_face_boolean_attached_to (Lisp_Object obj, Lisp_Object face,
|
|
980 Lisp_Object property)
|
|
981 {
|
|
982 struct Lisp_Specifier *face_boolean = XFACE_BOOLEAN_SPECIFIER (obj);
|
|
983
|
|
984 FACE_BOOLEAN_SPECIFIER_FACE (face_boolean) = face;
|
|
985 FACE_BOOLEAN_SPECIFIER_FACE_PROPERTY (face_boolean) = property;
|
|
986 }
|
|
987
|
20
|
988 DEFUN ("face-boolean-specifier-p", Fface_boolean_specifier_p, 1, 1, 0, /*
|
0
|
989 Return non-nil if OBJECT is a face-boolean specifier.
|
|
990
|
|
991 Valid instantiators for face-boolean specifiers are
|
|
992
|
|
993 -- t or nil
|
|
994 -- a vector of two or three elements: a face to inherit from,
|
|
995 optionally a symbol naming the property of that face to inherit from
|
|
996 (if omitted, defaults to the same property that this face-boolean
|
|
997 specifier is used for; if this specifier is not part of a face,
|
|
998 the instantiator would not be valid), and optionally a value which,
|
|
999 if non-nil, means to invert the sense of the inherited property.
|
20
|
1000 */
|
|
1001 (object))
|
0
|
1002 {
|
173
|
1003 return FACE_BOOLEAN_SPECIFIERP (object) ? Qt : Qnil;
|
0
|
1004 }
|
|
1005
|
|
1006
|
|
1007 /************************************************************************/
|
|
1008 /* initialization */
|
|
1009 /************************************************************************/
|
|
1010
|
|
1011 void
|
|
1012 syms_of_objects (void)
|
|
1013 {
|
20
|
1014 DEFSUBR (Fcolor_specifier_p);
|
|
1015 DEFSUBR (Ffont_specifier_p);
|
|
1016 DEFSUBR (Fface_boolean_specifier_p);
|
0
|
1017
|
|
1018 defsymbol (&Qcolor_instancep, "color-instance-p");
|
20
|
1019 DEFSUBR (Fmake_color_instance);
|
|
1020 DEFSUBR (Fcolor_instance_p);
|
|
1021 DEFSUBR (Fcolor_instance_name);
|
|
1022 DEFSUBR (Fcolor_instance_rgb_components);
|
|
1023 DEFSUBR (Fvalid_color_name_p);
|
0
|
1024
|
|
1025 defsymbol (&Qfont_instancep, "font-instance-p");
|
20
|
1026 DEFSUBR (Fmake_font_instance);
|
|
1027 DEFSUBR (Ffont_instance_p);
|
|
1028 DEFSUBR (Ffont_instance_name);
|
|
1029 DEFSUBR (Ffont_instance_ascent);
|
|
1030 DEFSUBR (Ffont_instance_descent);
|
|
1031 DEFSUBR (Ffont_instance_width);
|
|
1032 DEFSUBR (Ffont_instance_proportional_p);
|
|
1033 DEFSUBR (Ffont_instance_truename);
|
|
1034 DEFSUBR (Ffont_instance_properties);
|
|
1035 DEFSUBR (Flist_fonts);
|
0
|
1036
|
|
1037 /* Qcolor, Qfont defined in general.c */
|
|
1038 defsymbol (&Qface_boolean, "face-boolean");
|
|
1039 }
|
|
1040
|
|
1041 void
|
|
1042 specifier_type_create_objects (void)
|
|
1043 {
|
|
1044 INITIALIZE_SPECIFIER_TYPE_WITH_DATA (color, "color", "color-specifier-p");
|
|
1045 INITIALIZE_SPECIFIER_TYPE_WITH_DATA (font, "font", "font-specifier-p");
|
|
1046 INITIALIZE_SPECIFIER_TYPE_WITH_DATA (face_boolean, "face-boolean",
|
|
1047 "face-boolean-specifier-p");
|
|
1048
|
|
1049 SPECIFIER_HAS_METHOD (color, instantiate);
|
|
1050 SPECIFIER_HAS_METHOD (font, instantiate);
|
|
1051 SPECIFIER_HAS_METHOD (face_boolean, instantiate);
|
|
1052
|
|
1053 SPECIFIER_HAS_METHOD (color, validate);
|
|
1054 SPECIFIER_HAS_METHOD (font, validate);
|
|
1055 SPECIFIER_HAS_METHOD (face_boolean, validate);
|
|
1056
|
|
1057 SPECIFIER_HAS_METHOD (color, create);
|
|
1058 SPECIFIER_HAS_METHOD (font, create);
|
|
1059 SPECIFIER_HAS_METHOD (face_boolean, create);
|
|
1060
|
|
1061 SPECIFIER_HAS_METHOD (color, mark);
|
|
1062 SPECIFIER_HAS_METHOD (font, mark);
|
|
1063 SPECIFIER_HAS_METHOD (face_boolean, mark);
|
|
1064
|
|
1065 SPECIFIER_HAS_METHOD (color, after_change);
|
|
1066 SPECIFIER_HAS_METHOD (font, after_change);
|
|
1067 SPECIFIER_HAS_METHOD (face_boolean, after_change);
|
70
|
1068
|
|
1069 #ifdef MULE
|
|
1070 SPECIFIER_HAS_METHOD (font, validate_matchspec);
|
|
1071 #endif
|
0
|
1072 }
|
|
1073
|
|
1074 void
|
|
1075 vars_of_objects (void)
|
|
1076 {
|
|
1077 staticpro (&Vthe_null_color_instance);
|
|
1078 {
|
185
|
1079 struct Lisp_Color_Instance *c =
|
|
1080 alloc_lcrecord_type (struct Lisp_Color_Instance, lrecord_color_instance);
|
0
|
1081 c->name = Qnil;
|
|
1082 c->device = Qnil;
|
|
1083 c->data = 0;
|
|
1084
|
|
1085 XSETCOLOR_INSTANCE (Vthe_null_color_instance, c);
|
|
1086 }
|
173
|
1087
|
0
|
1088 staticpro (&Vthe_null_font_instance);
|
|
1089 {
|
185
|
1090 struct Lisp_Font_Instance *f =
|
|
1091 alloc_lcrecord_type (struct Lisp_Font_Instance, lrecord_font_instance);
|
0
|
1092 f->name = Qnil;
|
|
1093 f->device = Qnil;
|
|
1094 f->data = 0;
|
|
1095
|
|
1096 f->ascent = f->height = 0;
|
|
1097 f->descent = 0;
|
|
1098 f->width = 0;
|
|
1099 f->proportional_p = 0;
|
173
|
1100
|
0
|
1101 XSETFONT_INSTANCE (Vthe_null_font_instance, f);
|
|
1102 }
|
|
1103 }
|