annotate src/objects.c @ 510:5bdbc721d46a

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