Mercurial > hg > xemacs-beta
annotate src/fontcolor.c @ 5533:11da5b828d10
shell-command and shell-command-on-region API compliant with FSF 23.3.1
| author | Mats Lidell <mats.lidell@cag.se> |
|---|---|
| date | Sun, 31 Jul 2011 01:29:09 +0200 |
| parents | 308d34e9f07d |
| children | 56144c8593a8 |
| rev | line source |
|---|---|
| 428 | 1 /* Generic Objects and Functions. |
| 2 Copyright (C) 1995 Free Software Foundation, Inc. | |
| 3 Copyright (C) 1995 Board of Trustees, University of Illinois. | |
|
5015
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
4 Copyright (C) 1995, 1996, 2002, 2004, 2005, 2010 Ben Wing. |
|
5080
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
5 Copyright (C) 2010 Didier Verna |
| 428 | 6 |
| 7 This file is part of XEmacs. | |
| 8 | |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5191
diff
changeset
|
9 XEmacs is free software: you can redistribute it and/or modify it |
| 428 | 10 under the terms of the GNU General Public License as published by the |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5191
diff
changeset
|
11 Free Software Foundation, either version 3 of the License, or (at your |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5191
diff
changeset
|
12 option) any later version. |
| 428 | 13 |
| 14 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
| 15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| 17 for more details. | |
| 18 | |
| 19 You should have received a copy of the GNU General Public License | |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5191
diff
changeset
|
20 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 428 | 21 |
| 22 /* Synched up with: Not in FSF. */ | |
| 23 | |
| 24 #include <config.h> | |
| 25 #include "lisp.h" | |
| 26 | |
| 771 | 27 #include "buffer.h" |
| 872 | 28 #include "device-impl.h" |
| 428 | 29 #include "elhash.h" |
| 30 #include "faces.h" | |
| 31 #include "frame.h" | |
| 800 | 32 #include "glyphs.h" |
|
5176
8b2f75cecb89
rename objects* (.c, .h and .el files) to fontcolor*
Ben Wing <ben@xemacs.org>
parents:
5015
diff
changeset
|
33 #include "fontcolor-impl.h" |
| 428 | 34 #include "specifier.h" |
| 35 #include "window.h" | |
| 36 | |
| 1204 | 37 #ifdef HAVE_TTY |
| 38 #include "console-tty.h" | |
| 39 #endif | |
| 934 | 40 |
| 428 | 41 /* Objects that are substituted when an instantiation fails. |
| 42 If we leave in the Qunbound value, we will probably get crashes. */ | |
| 43 Lisp_Object Vthe_null_color_instance, Vthe_null_font_instance; | |
| 44 | |
|
5015
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
45 /* Author: Ben Wing; some earlier code from Chuck Thompson, Jamie |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
46 Zawinski. */ |
| 428 | 47 |
| 2268 | 48 DOESNT_RETURN |
| 428 | 49 finalose (void *ptr) |
| 50 { | |
| 793 | 51 Lisp_Object obj = wrap_pointer_1 (ptr); |
| 52 | |
| 563 | 53 invalid_operation |
| 428 | 54 ("Can't dump an emacs containing window system objects", obj); |
| 55 } | |
| 56 | |
| 57 | |
| 58 /**************************************************************************** | |
| 59 * Color-Instance Object * | |
| 60 ****************************************************************************/ | |
| 61 | |
| 62 Lisp_Object Qcolor_instancep; | |
| 63 | |
| 1204 | 64 static const struct memory_description color_instance_data_description_1 []= { |
| 65 #ifdef HAVE_TTY | |
| 3092 | 66 #ifdef NEW_GC |
| 67 { XD_LISP_OBJECT, tty_console }, | |
| 68 #else /* not NEW_GC */ | |
| 2551 | 69 { XD_BLOCK_PTR, tty_console, 1, { &tty_color_instance_data_description } }, |
| 3092 | 70 #endif /* not NEW_GC */ |
| 1204 | 71 #endif |
| 934 | 72 { XD_END } |
| 73 }; | |
| 74 | |
| 1204 | 75 static const struct sized_memory_description color_instance_data_description = { |
| 76 sizeof (void *), color_instance_data_description_1 | |
| 934 | 77 }; |
| 78 | |
| 1204 | 79 static const struct memory_description color_instance_description[] = { |
| 934 | 80 { XD_INT, offsetof (Lisp_Color_Instance, color_instance_type) }, |
| 81 { XD_LISP_OBJECT, offsetof (Lisp_Color_Instance, name)}, | |
| 82 { XD_LISP_OBJECT, offsetof (Lisp_Color_Instance, device)}, | |
| 1204 | 83 { XD_UNION, offsetof (Lisp_Color_Instance, data), |
| 2551 | 84 XD_INDIRECT (0, 0), { &color_instance_data_description } }, |
| 934 | 85 {XD_END} |
| 86 }; | |
| 87 | |
| 428 | 88 static Lisp_Object |
| 89 mark_color_instance (Lisp_Object obj) | |
| 90 { | |
| 440 | 91 Lisp_Color_Instance *c = XCOLOR_INSTANCE (obj); |
| 428 | 92 mark_object (c->name); |
| 93 if (!NILP (c->device)) /* Vthe_null_color_instance */ | |
| 94 MAYBE_DEVMETH (XDEVICE (c->device), mark_color_instance, (c)); | |
| 95 | |
| 96 return c->device; | |
| 97 } | |
| 98 | |
| 99 static void | |
| 100 print_color_instance (Lisp_Object obj, Lisp_Object printcharfun, | |
| 101 int escapeflag) | |
| 102 { | |
| 440 | 103 Lisp_Color_Instance *c = XCOLOR_INSTANCE (obj); |
| 428 | 104 if (print_readably) |
|
5142
f965e31a35f0
reduce lcrecord headers to 2 words, rename printing_unreadable_object
Ben Wing <ben@xemacs.org>
parents:
5128
diff
changeset
|
105 printing_unreadable_lisp_object (obj, 0); |
| 800 | 106 write_fmt_string_lisp (printcharfun, "#<color-instance %s", 1, c->name); |
| 107 write_fmt_string_lisp (printcharfun, " on %s", 1, c->device); | |
| 428 | 108 if (!NILP (c->device)) /* Vthe_null_color_instance */ |
| 109 MAYBE_DEVMETH (XDEVICE (c->device), print_color_instance, | |
| 110 (c, printcharfun, escapeflag)); | |
|
5146
88bd4f3ef8e4
make lrecord UID's have a separate UID space for each object, resurrect debug SOE code in extents.c
Ben Wing <ben@xemacs.org>
parents:
5142
diff
changeset
|
111 write_fmt_string (printcharfun, " 0x%x>", LISP_OBJECT_UID (obj)); |
| 428 | 112 } |
| 113 | |
| 114 static void | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
115 finalize_color_instance (Lisp_Object obj) |
| 428 | 116 { |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
117 Lisp_Color_Instance *c = XCOLOR_INSTANCE (obj); |
| 428 | 118 |
| 119 if (!NILP (c->device)) | |
|
5124
623d57b7fbe8
separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents:
5118
diff
changeset
|
120 MAYBE_DEVMETH (XDEVICE (c->device), finalize_color_instance, (c)); |
| 428 | 121 } |
| 122 | |
| 123 static int | |
|
4906
6ef8256a020a
implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents:
4846
diff
changeset
|
124 color_instance_equal (Lisp_Object obj1, Lisp_Object obj2, int depth, |
|
6ef8256a020a
implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents:
4846
diff
changeset
|
125 int UNUSED (foldcase)) |
| 428 | 126 { |
| 440 | 127 Lisp_Color_Instance *c1 = XCOLOR_INSTANCE (obj1); |
| 128 Lisp_Color_Instance *c2 = XCOLOR_INSTANCE (obj2); | |
| 428 | 129 |
| 130 return (c1 == c2) || | |
| 131 (EQ (c1->device, c2->device) && | |
| 132 DEVICEP (c1->device) && | |
| 133 HAS_DEVMETH_P (XDEVICE (c1->device), color_instance_equal) && | |
| 134 DEVMETH (XDEVICE (c1->device), color_instance_equal, (c1, c2, depth))); | |
| 135 } | |
| 136 | |
| 2515 | 137 static Hashcode |
|
5191
71ee43b8a74d
Add #'equalp as a hash test by default; add #'define-hash-table-test, GNU API
Aidan Kehoe <kehoea@parhasard.net>
parents:
5178
diff
changeset
|
138 color_instance_hash (Lisp_Object obj, int depth, Boolint UNUSED (equalp)) |
| 428 | 139 { |
| 440 | 140 Lisp_Color_Instance *c = XCOLOR_INSTANCE (obj); |
| 428 | 141 struct device *d = DEVICEP (c->device) ? XDEVICE (c->device) : 0; |
| 142 | |
| 2515 | 143 return HASH2 ((Hashcode) d, |
| 428 | 144 !d ? LISP_HASH (obj) |
| 145 : DEVMETH_OR_GIVEN (d, color_instance_hash, (c, depth), | |
| 146 LISP_HASH (obj))); | |
| 147 } | |
| 148 | |
|
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
diff
changeset
|
149 DEFINE_NODUMP_LISP_OBJECT ("color-instance", color_instance, |
|
5124
623d57b7fbe8
separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents:
5118
diff
changeset
|
150 mark_color_instance, print_color_instance, |
|
623d57b7fbe8
separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents:
5118
diff
changeset
|
151 finalize_color_instance, color_instance_equal, |
|
623d57b7fbe8
separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents:
5118
diff
changeset
|
152 color_instance_hash, |
|
623d57b7fbe8
separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents:
5118
diff
changeset
|
153 color_instance_description, |
|
623d57b7fbe8
separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents:
5118
diff
changeset
|
154 Lisp_Color_Instance); |
| 428 | 155 |
| 156 DEFUN ("make-color-instance", Fmake_color_instance, 1, 3, 0, /* | |
| 157 Return a new `color-instance' object named NAME (a string). | |
| 158 | |
| 159 Optional argument DEVICE specifies the device this object applies to | |
| 160 and defaults to the selected device. | |
| 161 | |
| 162 An error is signaled if the color is unknown or cannot be allocated; | |
| 444 | 163 however, if optional argument NOERROR is non-nil, nil is simply |
| 164 returned in this case. (And if NOERROR is other than t, a warning may | |
| 428 | 165 be issued.) |
| 166 | |
| 167 The returned object is a normal, first-class lisp object. The way you | |
| 168 `deallocate' the color is the way you deallocate any other lisp object: | |
| 169 you drop all pointers to it and allow it to be garbage collected. When | |
| 170 these objects are GCed, the underlying window-system data (e.g. X object) | |
| 171 is deallocated as well. | |
| 172 */ | |
| 444 | 173 (name, device, noerror)) |
| 428 | 174 { |
|
5117
3742ea8250b5
Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents:
3017
diff
changeset
|
175 Lisp_Object obj; |
| 440 | 176 Lisp_Color_Instance *c; |
| 428 | 177 int retval; |
| 178 | |
| 179 CHECK_STRING (name); | |
| 793 | 180 device = wrap_device (decode_device (device)); |
| 428 | 181 |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
182 obj = ALLOC_NORMAL_LISP_OBJECT (color_instance); |
|
5117
3742ea8250b5
Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents:
3017
diff
changeset
|
183 c = XCOLOR_INSTANCE (obj); |
| 428 | 184 c->name = name; |
| 185 c->device = device; | |
| 186 c->data = 0; | |
| 1204 | 187 c->color_instance_type = get_console_variant (XDEVICE_TYPE (c->device)); |
| 428 | 188 |
| 189 retval = MAYBE_INT_DEVMETH (XDEVICE (device), initialize_color_instance, | |
| 190 (c, name, device, | |
| 444 | 191 decode_error_behavior_flag (noerror))); |
| 428 | 192 if (!retval) |
| 193 return Qnil; | |
| 194 | |
|
5117
3742ea8250b5
Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents:
3017
diff
changeset
|
195 return obj; |
| 428 | 196 } |
| 197 | |
| 198 DEFUN ("color-instance-p", Fcolor_instance_p, 1, 1, 0, /* | |
| 199 Return non-nil if OBJECT is a color instance. | |
| 200 */ | |
| 201 (object)) | |
| 202 { | |
| 203 return COLOR_INSTANCEP (object) ? Qt : Qnil; | |
| 204 } | |
| 205 | |
| 206 DEFUN ("color-instance-name", Fcolor_instance_name, 1, 1, 0, /* | |
| 207 Return the name used to allocate COLOR-INSTANCE. | |
| 208 */ | |
| 209 (color_instance)) | |
| 210 { | |
| 211 CHECK_COLOR_INSTANCE (color_instance); | |
| 212 return XCOLOR_INSTANCE (color_instance)->name; | |
| 213 } | |
| 214 | |
| 215 DEFUN ("color-instance-rgb-components", Fcolor_instance_rgb_components, 1, 1, 0, /* | |
| 216 Return a three element list containing the red, green, and blue | |
| 217 color components of COLOR-INSTANCE, or nil if unknown. | |
| 218 Component values range from 0 to 65535. | |
| 219 */ | |
| 220 (color_instance)) | |
| 221 { | |
| 440 | 222 Lisp_Color_Instance *c; |
| 428 | 223 |
| 224 CHECK_COLOR_INSTANCE (color_instance); | |
| 225 c = XCOLOR_INSTANCE (color_instance); | |
| 226 | |
| 227 if (NILP (c->device)) | |
| 228 return Qnil; | |
| 229 | |
| 230 return MAYBE_LISP_DEVMETH (XDEVICE (c->device), | |
| 231 color_instance_rgb_components, | |
| 232 (c)); | |
| 233 } | |
| 234 | |
| 235 DEFUN ("valid-color-name-p", Fvalid_color_name_p, 1, 2, 0, /* | |
| 236 Return true if COLOR names a valid color for the current device. | |
| 237 | |
| 238 Valid color names for X are listed in the file /usr/lib/X11/rgb.txt, or | |
| 239 whatever the equivalent is on your system. | |
| 240 | |
| 241 Valid color names for TTY are those which have an ISO 6429 (ANSI) sequence. | |
| 242 In addition to being a color this may be one of a number of attributes | |
| 243 such as `blink'. | |
| 244 */ | |
| 245 (color, device)) | |
| 246 { | |
| 247 struct device *d = decode_device (device); | |
| 248 | |
| 249 CHECK_STRING (color); | |
| 250 return MAYBE_INT_DEVMETH (d, valid_color_name_p, (d, color)) ? Qt : Qnil; | |
| 251 } | |
| 252 | |
| 2527 | 253 DEFUN ("color-list", Fcolor_list, 0, 1, 0, /* |
| 254 Return a list of color names. | |
| 255 DEVICE specifies which device to return names for, and defaults to the | |
| 256 currently selected device. | |
| 257 */ | |
| 258 (device)) | |
| 259 { | |
| 260 device = wrap_device (decode_device (device)); | |
| 261 | |
| 262 return MAYBE_LISP_DEVMETH (XDEVICE (device), color_list, ()); | |
| 263 } | |
| 264 | |
| 428 | 265 |
| 266 /*************************************************************************** | |
| 267 * Font-Instance Object * | |
| 268 ***************************************************************************/ | |
| 269 | |
| 270 Lisp_Object Qfont_instancep; | |
| 271 | |
| 272 static Lisp_Object font_instance_truename_internal (Lisp_Object xfont, | |
| 578 | 273 Error_Behavior errb); |
| 934 | 274 |
| 1204 | 275 static const struct memory_description font_instance_data_description_1 []= { |
| 276 #ifdef HAVE_TTY | |
| 3092 | 277 #ifdef NEW_GC |
| 278 { XD_LISP_OBJECT, tty_console }, | |
| 279 #else /* not NEW_GC */ | |
| 280 { XD_BLOCK_PTR, tty_console, 1, { &tty_font_instance_data_description } }, | |
| 281 #endif /* not NEW_GC */ | |
| 1204 | 282 #endif |
| 934 | 283 { XD_END } |
| 284 }; | |
| 285 | |
| 1204 | 286 static const struct sized_memory_description font_instance_data_description = { |
| 287 sizeof (void *), font_instance_data_description_1 | |
| 934 | 288 }; |
| 289 | |
| 1204 | 290 static const struct memory_description font_instance_description[] = { |
| 934 | 291 { XD_INT, offsetof (Lisp_Font_Instance, font_instance_type) }, |
| 292 { XD_LISP_OBJECT, offsetof (Lisp_Font_Instance, name)}, | |
| 293 { XD_LISP_OBJECT, offsetof (Lisp_Font_Instance, truename)}, | |
| 294 { XD_LISP_OBJECT, offsetof (Lisp_Font_Instance, device)}, | |
| 3094 | 295 { XD_LISP_OBJECT, offsetof (Lisp_Font_Instance, charset)}, |
|
4426
515b91f904c1
Fix specifier inheritance behavior
Didier Verna <didier@xemacs.org>
parents:
3659
diff
changeset
|
296 { XD_UNION, offsetof (Lisp_Font_Instance, data), |
| 2551 | 297 XD_INDIRECT (0, 0), { &font_instance_data_description } }, |
| 1204 | 298 { XD_END } |
| 934 | 299 }; |
| 300 | |
| 428 | 301 |
| 302 static Lisp_Object | |
| 303 mark_font_instance (Lisp_Object obj) | |
| 304 { | |
| 440 | 305 Lisp_Font_Instance *f = XFONT_INSTANCE (obj); |
| 428 | 306 |
| 307 mark_object (f->name); | |
| 872 | 308 mark_object (f->truename); |
| 428 | 309 if (!NILP (f->device)) /* Vthe_null_font_instance */ |
| 310 MAYBE_DEVMETH (XDEVICE (f->device), mark_font_instance, (f)); | |
| 311 | |
| 312 return f->device; | |
| 313 } | |
| 314 | |
| 315 static void | |
| 316 print_font_instance (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) | |
| 317 { | |
| 440 | 318 Lisp_Font_Instance *f = XFONT_INSTANCE (obj); |
| 428 | 319 if (print_readably) |
|
5142
f965e31a35f0
reduce lcrecord headers to 2 words, rename printing_unreadable_object
Ben Wing <ben@xemacs.org>
parents:
5128
diff
changeset
|
320 printing_unreadable_lisp_object (obj, 0); |
| 800 | 321 write_fmt_string_lisp (printcharfun, "#<font-instance %S", 1, f->name); |
| 322 write_fmt_string_lisp (printcharfun, " on %s", 1, f->device); | |
| 428 | 323 if (!NILP (f->device)) |
| 3659 | 324 { |
| 325 MAYBE_DEVMETH (XDEVICE (f->device), print_font_instance, | |
| 326 (f, printcharfun, escapeflag)); | |
| 327 | |
| 328 } | |
|
5146
88bd4f3ef8e4
make lrecord UID's have a separate UID space for each object, resurrect debug SOE code in extents.c
Ben Wing <ben@xemacs.org>
parents:
5142
diff
changeset
|
329 write_fmt_string (printcharfun, " 0x%x>", LISP_OBJECT_UID (obj)); |
| 428 | 330 } |
| 331 | |
| 332 static void | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
333 finalize_font_instance (Lisp_Object obj) |
| 428 | 334 { |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
335 Lisp_Font_Instance *f = XFONT_INSTANCE (obj); |
| 428 | 336 |
| 337 if (!NILP (f->device)) | |
| 338 { | |
| 339 MAYBE_DEVMETH (XDEVICE (f->device), finalize_font_instance, (f)); | |
| 340 } | |
| 341 } | |
| 342 | |
| 343 /* Fonts are equal if they resolve to the same name. | |
| 344 Since we call `font-truename' to do this, and since font-truename is lazy, | |
| 345 this means the `equal' could cause XListFonts to be run the first time. | |
| 346 */ | |
| 347 static int | |
|
4906
6ef8256a020a
implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents:
4846
diff
changeset
|
348 font_instance_equal (Lisp_Object obj1, Lisp_Object obj2, int depth, |
|
6ef8256a020a
implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents:
4846
diff
changeset
|
349 int UNUSED (foldcase)) |
| 428 | 350 { |
| 351 /* #### should this be moved into a device method? */ | |
| 793 | 352 return internal_equal (font_instance_truename_internal |
| 353 (obj1, ERROR_ME_DEBUG_WARN), | |
| 354 font_instance_truename_internal | |
| 355 (obj2, ERROR_ME_DEBUG_WARN), | |
| 428 | 356 depth + 1); |
| 357 } | |
| 358 | |
| 2515 | 359 static Hashcode |
|
5191
71ee43b8a74d
Add #'equalp as a hash test by default; add #'define-hash-table-test, GNU API
Aidan Kehoe <kehoea@parhasard.net>
parents:
5178
diff
changeset
|
360 font_instance_hash (Lisp_Object obj, int depth, Boolint UNUSED (equalp)) |
| 428 | 361 { |
| 793 | 362 return internal_hash (font_instance_truename_internal |
| 363 (obj, ERROR_ME_DEBUG_WARN), | |
|
5191
71ee43b8a74d
Add #'equalp as a hash test by default; add #'define-hash-table-test, GNU API
Aidan Kehoe <kehoea@parhasard.net>
parents:
5178
diff
changeset
|
364 depth + 1, 0); |
| 428 | 365 } |
| 366 | |
|
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
diff
changeset
|
367 DEFINE_NODUMP_LISP_OBJECT ("font-instance", font_instance, |
|
5124
623d57b7fbe8
separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents:
5118
diff
changeset
|
368 mark_font_instance, print_font_instance, |
|
623d57b7fbe8
separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents:
5118
diff
changeset
|
369 finalize_font_instance, font_instance_equal, |
|
623d57b7fbe8
separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents:
5118
diff
changeset
|
370 font_instance_hash, font_instance_description, |
|
623d57b7fbe8
separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents:
5118
diff
changeset
|
371 Lisp_Font_Instance); |
| 934 | 372 |
| 428 | 373 |
| 3094 | 374 /* #### Why is this exposed to Lisp? Used in: |
| 375 x-frob-font-size, gtk-font-menu-load-font, x-font-menu-load-font-xft, | |
| 376 x-font-menu-load-font-core, mswindows-font-menu-load-font, | |
| 377 mswindows-frob-font-style-and-sizify, mswindows-frob-font-size. */ | |
| 378 DEFUN ("make-font-instance", Fmake_font_instance, 1, 4, 0, /* | |
| 428 | 379 Return a new `font-instance' object named NAME. |
| 380 DEVICE specifies the device this object applies to and defaults to the | |
| 381 selected device. An error is signalled if the font is unknown or cannot | |
| 382 be allocated; however, if NOERROR is non-nil, nil is simply returned in | |
| 3094 | 383 this case. CHARSET is used internally. #### make helper function? |
| 428 | 384 |
| 385 The returned object is a normal, first-class lisp object. The way you | |
| 386 `deallocate' the font is the way you deallocate any other lisp object: | |
| 387 you drop all pointers to it and allow it to be garbage collected. When | |
| 3094 | 388 these objects are GCed, the underlying GUI data is deallocated as well. |
| 428 | 389 */ |
| 3094 | 390 (name, device, noerror, charset)) |
| 428 | 391 { |
|
5117
3742ea8250b5
Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents:
3017
diff
changeset
|
392 Lisp_Object obj; |
| 440 | 393 Lisp_Font_Instance *f; |
| 428 | 394 int retval = 0; |
| 578 | 395 Error_Behavior errb = decode_error_behavior_flag (noerror); |
| 428 | 396 |
| 397 if (ERRB_EQ (errb, ERROR_ME)) | |
| 398 CHECK_STRING (name); | |
| 399 else if (!STRINGP (name)) | |
| 400 return Qnil; | |
| 401 | |
| 793 | 402 device = wrap_device (decode_device (device)); |
| 428 | 403 |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
404 obj = ALLOC_NORMAL_LISP_OBJECT (font_instance); |
|
5117
3742ea8250b5
Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents:
3017
diff
changeset
|
405 f = XFONT_INSTANCE (obj); |
| 428 | 406 f->name = name; |
| 872 | 407 f->truename = Qnil; |
| 428 | 408 f->device = device; |
| 409 | |
| 410 f->data = 0; | |
| 1204 | 411 f->font_instance_type = get_console_variant (XDEVICE_TYPE (f->device)); |
| 428 | 412 |
| 413 /* Stick some default values here ... */ | |
| 414 f->ascent = f->height = 1; | |
| 415 f->descent = 0; | |
| 416 f->width = 1; | |
| 3094 | 417 f->charset = charset; |
| 428 | 418 f->proportional_p = 0; |
| 419 | |
| 420 retval = MAYBE_INT_DEVMETH (XDEVICE (device), initialize_font_instance, | |
| 421 (f, name, device, errb)); | |
| 422 | |
| 423 if (!retval) | |
| 424 return Qnil; | |
| 425 | |
|
5117
3742ea8250b5
Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents:
3017
diff
changeset
|
426 return obj; |
| 428 | 427 } |
| 428 | |
| 429 DEFUN ("font-instance-p", Ffont_instance_p, 1, 1, 0, /* | |
| 430 Return non-nil if OBJECT is a font instance. | |
| 431 */ | |
| 432 (object)) | |
| 433 { | |
| 434 return FONT_INSTANCEP (object) ? Qt : Qnil; | |
| 435 } | |
| 436 | |
| 437 DEFUN ("font-instance-name", Ffont_instance_name, 1, 1, 0, /* | |
| 438 Return the name used to allocate FONT-INSTANCE. | |
| 439 */ | |
| 440 (font_instance)) | |
| 441 { | |
| 442 CHECK_FONT_INSTANCE (font_instance); | |
| 443 return XFONT_INSTANCE (font_instance)->name; | |
| 444 } | |
| 445 | |
| 446 DEFUN ("font-instance-ascent", Ffont_instance_ascent, 1, 1, 0, /* | |
| 447 Return the ascent in pixels of FONT-INSTANCE. | |
| 448 The returned value is the maximum ascent for all characters in the font, | |
| 449 where a character's ascent is the number of pixels above (and including) | |
| 450 the baseline. | |
| 451 */ | |
| 452 (font_instance)) | |
| 453 { | |
| 454 CHECK_FONT_INSTANCE (font_instance); | |
| 455 return make_int (XFONT_INSTANCE (font_instance)->ascent); | |
| 456 } | |
| 457 | |
| 458 DEFUN ("font-instance-descent", Ffont_instance_descent, 1, 1, 0, /* | |
| 459 Return the descent in pixels of FONT-INSTANCE. | |
| 460 The returned value is the maximum descent for all characters in the font, | |
| 461 where a character's descent is the number of pixels below the baseline. | |
| 462 \(Many characters to do not have any descent. Typical characters with a | |
| 463 descent are lowercase p and lowercase g.) | |
| 464 */ | |
| 465 (font_instance)) | |
| 466 { | |
| 467 CHECK_FONT_INSTANCE (font_instance); | |
| 468 return make_int (XFONT_INSTANCE (font_instance)->descent); | |
| 469 } | |
| 470 | |
| 471 DEFUN ("font-instance-width", Ffont_instance_width, 1, 1, 0, /* | |
| 472 Return the width in pixels of FONT-INSTANCE. | |
| 473 The returned value is the average width for all characters in the font. | |
| 474 */ | |
| 475 (font_instance)) | |
| 476 { | |
| 477 CHECK_FONT_INSTANCE (font_instance); | |
| 478 return make_int (XFONT_INSTANCE (font_instance)->width); | |
| 479 } | |
| 480 | |
| 481 DEFUN ("font-instance-proportional-p", Ffont_instance_proportional_p, 1, 1, 0, /* | |
| 482 Return whether FONT-INSTANCE is proportional. | |
| 483 This means that different characters in the font have different widths. | |
| 484 */ | |
| 485 (font_instance)) | |
| 486 { | |
| 487 CHECK_FONT_INSTANCE (font_instance); | |
| 488 return XFONT_INSTANCE (font_instance)->proportional_p ? Qt : Qnil; | |
| 489 } | |
| 490 | |
| 491 static Lisp_Object | |
| 492 font_instance_truename_internal (Lisp_Object font_instance, | |
| 578 | 493 Error_Behavior errb) |
| 428 | 494 { |
| 440 | 495 Lisp_Font_Instance *f = XFONT_INSTANCE (font_instance); |
| 496 | |
| 428 | 497 if (NILP (f->device)) |
| 498 { | |
|
4757
a23ac8f90a49
Improve warning and error messages from Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4426
diff
changeset
|
499 maybe_signal_error (Qgui_error, |
|
a23ac8f90a49
Improve warning and error messages from Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4426
diff
changeset
|
500 "can't determine truename: " |
|
a23ac8f90a49
Improve warning and error messages from Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4426
diff
changeset
|
501 "no device for font instance", |
|
a23ac8f90a49
Improve warning and error messages from Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4426
diff
changeset
|
502 font_instance, Qfont, errb); |
| 428 | 503 return Qnil; |
| 504 } | |
| 440 | 505 |
| 428 | 506 return DEVMETH_OR_GIVEN (XDEVICE (f->device), |
| 507 font_instance_truename, (f, errb), f->name); | |
| 508 } | |
| 509 | |
| 510 DEFUN ("font-instance-truename", Ffont_instance_truename, 1, 1, 0, /* | |
| 511 Return the canonical name of FONT-INSTANCE. | |
| 512 Font names are patterns which may match any number of fonts, of which | |
| 513 the first found is used. This returns an unambiguous name for that font | |
| 514 \(but not necessarily its only unambiguous name). | |
| 515 */ | |
| 516 (font_instance)) | |
| 517 { | |
| 518 CHECK_FONT_INSTANCE (font_instance); | |
| 519 return font_instance_truename_internal (font_instance, ERROR_ME); | |
| 520 } | |
| 521 | |
| 3094 | 522 DEFUN ("font-instance-charset", Ffont_instance_charset, 1, 1, 0, /* |
| 523 Return the Mule charset that FONT-INSTANCE was allocated to handle. | |
| 524 */ | |
| 525 (font_instance)) | |
| 526 { | |
| 527 CHECK_FONT_INSTANCE (font_instance); | |
| 528 return XFONT_INSTANCE (font_instance)->charset; | |
| 529 } | |
| 530 | |
| 428 | 531 DEFUN ("font-instance-properties", Ffont_instance_properties, 1, 1, 0, /* |
| 532 Return the properties (an alist or nil) of FONT-INSTANCE. | |
| 533 */ | |
| 534 (font_instance)) | |
| 535 { | |
| 440 | 536 Lisp_Font_Instance *f; |
| 428 | 537 |
| 538 CHECK_FONT_INSTANCE (font_instance); | |
| 539 f = XFONT_INSTANCE (font_instance); | |
| 540 | |
| 541 if (NILP (f->device)) | |
| 542 return Qnil; | |
| 543 | |
| 544 return MAYBE_LISP_DEVMETH (XDEVICE (f->device), | |
| 545 font_instance_properties, (f)); | |
| 546 } | |
| 547 | |
| 2527 | 548 DEFUN ("font-list", Ffont_list, 1, 3, 0, /* |
| 428 | 549 Return a list of font names matching the given pattern. |
| 550 DEVICE specifies which device to search for names, and defaults to the | |
| 551 currently selected device. | |
| 552 */ | |
| 1701 | 553 (pattern, device, maxnumber)) |
| 428 | 554 { |
| 555 CHECK_STRING (pattern); | |
| 793 | 556 device = wrap_device (decode_device (device)); |
| 428 | 557 |
| 2527 | 558 return MAYBE_LISP_DEVMETH (XDEVICE (device), font_list, (pattern, device, |
| 1701 | 559 maxnumber)); |
| 428 | 560 } |
| 561 | |
| 562 | |
| 563 /**************************************************************************** | |
| 564 Color Object | |
| 565 ***************************************************************************/ | |
| 1204 | 566 |
| 567 static const struct memory_description color_specifier_description[] = { | |
| 568 { XD_LISP_OBJECT, offsetof (struct color_specifier, face) }, | |
| 569 { XD_LISP_OBJECT, offsetof (struct color_specifier, face_property) }, | |
| 570 { XD_END } | |
| 571 }; | |
| 572 | |
| 573 DEFINE_SPECIFIER_TYPE_WITH_DATA (color); | |
| 428 | 574 /* Qcolor defined in general.c */ |
| 575 | |
| 576 static void | |
| 577 color_create (Lisp_Object obj) | |
| 578 { | |
| 440 | 579 Lisp_Specifier *color = XCOLOR_SPECIFIER (obj); |
| 428 | 580 |
| 581 COLOR_SPECIFIER_FACE (color) = Qnil; | |
| 582 COLOR_SPECIFIER_FACE_PROPERTY (color) = Qnil; | |
| 583 } | |
| 584 | |
| 585 static void | |
| 586 color_mark (Lisp_Object obj) | |
| 587 { | |
| 440 | 588 Lisp_Specifier *color = XCOLOR_SPECIFIER (obj); |
| 428 | 589 |
| 590 mark_object (COLOR_SPECIFIER_FACE (color)); | |
| 591 mark_object (COLOR_SPECIFIER_FACE_PROPERTY (color)); | |
| 592 } | |
| 593 | |
| 594 /* No equal or hash methods; ignore the face the color is based off | |
| 595 of for `equal' */ | |
| 596 | |
| 597 static Lisp_Object | |
| 2286 | 598 color_instantiate (Lisp_Object specifier, Lisp_Object UNUSED (matchspec), |
| 428 | 599 Lisp_Object domain, Lisp_Object instantiator, |
|
4426
515b91f904c1
Fix specifier inheritance behavior
Didier Verna <didier@xemacs.org>
parents:
3659
diff
changeset
|
600 Lisp_Object depth, int no_fallback) |
| 428 | 601 { |
| 602 /* When called, we're inside of call_with_suspended_errors(), | |
| 603 so we can freely error. */ | |
| 442 | 604 Lisp_Object device = DOMAIN_DEVICE (domain); |
| 428 | 605 struct device *d = XDEVICE (device); |
| 606 | |
| 607 if (COLOR_INSTANCEP (instantiator)) | |
| 608 { | |
| 609 /* If we are on the same device then we're done. Otherwise change | |
|
4426
515b91f904c1
Fix specifier inheritance behavior
Didier Verna <didier@xemacs.org>
parents:
3659
diff
changeset
|
610 the instantiator to the name used to generate the pixel and let the |
|
515b91f904c1
Fix specifier inheritance behavior
Didier Verna <didier@xemacs.org>
parents:
3659
diff
changeset
|
611 STRINGP case deal with it. */ |
| 428 | 612 if (NILP (device) /* Vthe_null_color_instance */ |
|
4426
515b91f904c1
Fix specifier inheritance behavior
Didier Verna <didier@xemacs.org>
parents:
3659
diff
changeset
|
613 || EQ (device, XCOLOR_INSTANCE (instantiator)->device)) |
| 428 | 614 return instantiator; |
| 615 else | |
| 616 instantiator = Fcolor_instance_name (instantiator); | |
| 617 } | |
| 618 | |
| 619 if (STRINGP (instantiator)) | |
| 620 { | |
| 621 /* First, look to see if we can retrieve a cached value. */ | |
| 622 Lisp_Object instance = | |
| 623 Fgethash (instantiator, d->color_instance_cache, Qunbound); | |
| 624 /* Otherwise, make a new one. */ | |
| 625 if (UNBOUNDP (instance)) | |
| 626 { | |
| 627 /* make sure we cache the failures, too. */ | |
| 628 instance = Fmake_color_instance (instantiator, device, Qt); | |
| 629 Fputhash (instantiator, instance, d->color_instance_cache); | |
| 630 } | |
| 631 | |
| 632 return NILP (instance) ? Qunbound : instance; | |
| 633 } | |
| 634 else if (VECTORP (instantiator)) | |
| 635 { | |
| 636 switch (XVECTOR_LENGTH (instantiator)) | |
| 637 { | |
| 638 case 0: | |
| 639 if (DEVICE_TTY_P (d)) | |
| 640 return Vthe_null_color_instance; | |
| 641 else | |
| 563 | 642 gui_error ("Color instantiator [] only valid on TTY's", |
| 428 | 643 device); |
| 644 | |
| 645 case 1: | |
| 646 if (NILP (COLOR_SPECIFIER_FACE (XCOLOR_SPECIFIER (specifier)))) | |
| 563 | 647 gui_error ("Color specifier not attached to a face", |
| 428 | 648 instantiator); |
| 649 return (FACE_PROPERTY_INSTANCE_1 | |
| 650 (Fget_face (XVECTOR_DATA (instantiator)[0]), | |
|
4426
515b91f904c1
Fix specifier inheritance behavior
Didier Verna <didier@xemacs.org>
parents:
3659
diff
changeset
|
651 COLOR_SPECIFIER_FACE_PROPERTY |
|
515b91f904c1
Fix specifier inheritance behavior
Didier Verna <didier@xemacs.org>
parents:
3659
diff
changeset
|
652 (XCOLOR_SPECIFIER (specifier)), |
|
515b91f904c1
Fix specifier inheritance behavior
Didier Verna <didier@xemacs.org>
parents:
3659
diff
changeset
|
653 domain, ERROR_ME, no_fallback, depth)); |
| 428 | 654 |
| 655 case 2: | |
| 656 return (FACE_PROPERTY_INSTANCE_1 | |
| 657 (Fget_face (XVECTOR_DATA (instantiator)[0]), | |
|
4426
515b91f904c1
Fix specifier inheritance behavior
Didier Verna <didier@xemacs.org>
parents:
3659
diff
changeset
|
658 XVECTOR_DATA (instantiator)[1], domain, ERROR_ME, |
|
515b91f904c1
Fix specifier inheritance behavior
Didier Verna <didier@xemacs.org>
parents:
3659
diff
changeset
|
659 no_fallback, depth)); |
| 428 | 660 |
| 661 default: | |
| 2500 | 662 ABORT (); |
| 428 | 663 } |
| 664 } | |
| 665 else if (NILP (instantiator)) | |
| 666 { | |
| 667 if (DEVICE_TTY_P (d)) | |
| 668 return Vthe_null_color_instance; | |
| 669 else | |
| 563 | 670 gui_error ("Color instantiator [] only valid on TTY's", |
| 428 | 671 device); |
| 672 } | |
| 673 else | |
| 2500 | 674 ABORT (); /* The spec validation routines are screwed up. */ |
| 428 | 675 |
| 676 return Qunbound; | |
| 677 } | |
| 678 | |
| 679 static void | |
| 680 color_validate (Lisp_Object instantiator) | |
| 681 { | |
| 682 if (COLOR_INSTANCEP (instantiator) || STRINGP (instantiator)) | |
| 683 return; | |
| 684 if (VECTORP (instantiator)) | |
| 685 { | |
| 686 if (XVECTOR_LENGTH (instantiator) > 2) | |
| 563 | 687 sferror ("Inheritance vector must be of size 0 - 2", |
| 428 | 688 instantiator); |
| 689 else if (XVECTOR_LENGTH (instantiator) > 0) | |
| 690 { | |
| 691 Lisp_Object face = XVECTOR_DATA (instantiator)[0]; | |
| 692 | |
| 693 Fget_face (face); | |
| 694 if (XVECTOR_LENGTH (instantiator) == 2) | |
| 695 { | |
| 696 Lisp_Object field = XVECTOR_DATA (instantiator)[1]; | |
| 697 if (!EQ (field, Qforeground) && !EQ (field, Qbackground)) | |
| 563 | 698 invalid_constant |
| 428 | 699 ("Inheritance field must be `foreground' or `background'", |
| 700 field); | |
| 701 } | |
| 702 } | |
| 703 } | |
| 704 else | |
| 563 | 705 invalid_argument ("Invalid color instantiator", instantiator); |
| 428 | 706 } |
| 707 | |
| 708 static void | |
| 709 color_after_change (Lisp_Object specifier, Lisp_Object locale) | |
| 710 { | |
| 711 Lisp_Object face = COLOR_SPECIFIER_FACE (XCOLOR_SPECIFIER (specifier)); | |
| 712 Lisp_Object property = | |
| 713 COLOR_SPECIFIER_FACE_PROPERTY (XCOLOR_SPECIFIER (specifier)); | |
| 714 if (!NILP (face)) | |
| 448 | 715 { |
| 716 face_property_was_changed (face, property, locale); | |
| 717 if (BUFFERP (locale)) | |
| 718 XBUFFER (locale)->buffer_local_face_property = 1; | |
| 719 } | |
| 428 | 720 } |
| 721 | |
| 722 void | |
| 723 set_color_attached_to (Lisp_Object obj, Lisp_Object face, Lisp_Object property) | |
| 724 { | |
| 440 | 725 Lisp_Specifier *color = XCOLOR_SPECIFIER (obj); |
| 428 | 726 |
| 727 COLOR_SPECIFIER_FACE (color) = face; | |
| 728 COLOR_SPECIFIER_FACE_PROPERTY (color) = property; | |
| 729 } | |
| 730 | |
| 731 DEFUN ("color-specifier-p", Fcolor_specifier_p, 1, 1, 0, /* | |
| 732 Return t if OBJECT is a color specifier. | |
| 733 | |
| 442 | 734 See `make-color-specifier' for a description of possible color instantiators. |
| 428 | 735 */ |
| 736 (object)) | |
| 737 { | |
| 738 return COLOR_SPECIFIERP (object) ? Qt : Qnil; | |
| 739 } | |
| 740 | |
| 741 | |
| 742 /**************************************************************************** | |
| 743 Font Object | |
| 744 ***************************************************************************/ | |
| 1204 | 745 |
| 746 static const struct memory_description font_specifier_description[] = { | |
| 747 { XD_LISP_OBJECT, offsetof (struct font_specifier, face) }, | |
| 748 { XD_LISP_OBJECT, offsetof (struct font_specifier, face_property) }, | |
| 749 { XD_END } | |
| 750 }; | |
| 751 | |
| 752 DEFINE_SPECIFIER_TYPE_WITH_DATA (font); | |
| 428 | 753 /* Qfont defined in general.c */ |
| 754 | |
| 755 static void | |
| 756 font_create (Lisp_Object obj) | |
| 757 { | |
| 440 | 758 Lisp_Specifier *font = XFONT_SPECIFIER (obj); |
| 428 | 759 |
| 760 FONT_SPECIFIER_FACE (font) = Qnil; | |
| 761 FONT_SPECIFIER_FACE_PROPERTY (font) = Qnil; | |
| 762 } | |
| 763 | |
| 764 static void | |
| 765 font_mark (Lisp_Object obj) | |
| 766 { | |
| 440 | 767 Lisp_Specifier *font = XFONT_SPECIFIER (obj); |
| 428 | 768 |
| 769 mark_object (FONT_SPECIFIER_FACE (font)); | |
| 770 mark_object (FONT_SPECIFIER_FACE_PROPERTY (font)); | |
| 771 } | |
| 772 | |
| 773 /* No equal or hash methods; ignore the face the font is based off | |
| 774 of for `equal' */ | |
| 775 | |
| 776 #ifdef MULE | |
| 777 | |
| 872 | 778 /* Given a truename font spec (i.e. the font spec should have its registry |
| 779 field filled in), does it support displaying characters from CHARSET? */ | |
| 780 | |
| 781 static int | |
| 428 | 782 font_spec_matches_charset (struct device *d, Lisp_Object charset, |
| 867 | 783 const Ibyte *nonreloc, Lisp_Object reloc, |
| 872 | 784 Bytecount offset, Bytecount length, |
| 3659 | 785 enum font_specifier_matchspec_stages stage) |
| 428 | 786 { |
| 787 return DEVMETH_OR_GIVEN (d, font_spec_matches_charset, | |
| 872 | 788 (d, charset, nonreloc, reloc, offset, length, |
| 789 stage), | |
| 428 | 790 1); |
| 791 } | |
| 792 | |
| 793 static void | |
| 794 font_validate_matchspec (Lisp_Object matchspec) | |
| 795 { | |
| 872 | 796 CHECK_CONS (matchspec); |
| 797 Fget_charset (XCAR (matchspec)); | |
| 3659 | 798 |
| 799 do | |
| 800 { | |
| 801 if (EQ(XCDR(matchspec), Qinitial)) | |
| 802 { | |
| 803 break; | |
| 804 } | |
| 805 if (EQ(XCDR(matchspec), Qfinal)) | |
| 806 { | |
| 807 break; | |
| 808 } | |
| 809 | |
| 810 invalid_argument("Invalid font matchspec stage", | |
| 811 XCDR(matchspec)); | |
| 812 } while (0); | |
| 428 | 813 } |
| 814 | |
| 872 | 815 void |
| 816 initialize_charset_font_caches (struct device *d) | |
| 817 { | |
| 818 /* Note that the following tables are bi-level. */ | |
| 819 d->charset_font_cache_stage_1 = | |
|
5191
71ee43b8a74d
Add #'equalp as a hash test by default; add #'define-hash-table-test, GNU API
Aidan Kehoe <kehoea@parhasard.net>
parents:
5178
diff
changeset
|
820 make_lisp_hash_table (20, HASH_TABLE_NON_WEAK, Qeq); |
| 872 | 821 d->charset_font_cache_stage_2 = |
|
5191
71ee43b8a74d
Add #'equalp as a hash test by default; add #'define-hash-table-test, GNU API
Aidan Kehoe <kehoea@parhasard.net>
parents:
5178
diff
changeset
|
822 make_lisp_hash_table (20, HASH_TABLE_NON_WEAK, Qeq); |
| 872 | 823 } |
| 824 | |
| 825 void | |
| 826 invalidate_charset_font_caches (Lisp_Object charset) | |
| 827 { | |
| 828 /* Invalidate font cache entries for charset on all devices. */ | |
| 829 Lisp_Object devcons, concons, hash_table; | |
| 830 DEVICE_LOOP_NO_BREAK (devcons, concons) | |
| 831 { | |
| 832 struct device *d = XDEVICE (XCAR (devcons)); | |
| 833 hash_table = Fgethash (charset, d->charset_font_cache_stage_1, | |
| 834 Qunbound); | |
| 835 if (!UNBOUNDP (hash_table)) | |
|
4426
515b91f904c1
Fix specifier inheritance behavior
Didier Verna <didier@xemacs.org>
parents:
3659
diff
changeset
|
836 Fclrhash (hash_table); |
| 872 | 837 hash_table = Fgethash (charset, d->charset_font_cache_stage_2, |
| 838 Qunbound); | |
| 839 if (!UNBOUNDP (hash_table)) | |
|
4426
515b91f904c1
Fix specifier inheritance behavior
Didier Verna <didier@xemacs.org>
parents:
3659
diff
changeset
|
840 Fclrhash (hash_table); |
| 872 | 841 } |
| 842 } | |
| 428 | 843 |
| 874 | 844 #endif /* MULE */ |
| 845 | |
|
5015
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
846 /* It's a little non-obvious what's going on here. Specifically: |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
847 |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
848 MATCHSPEC is a somewhat bogus way in the specifier mechanism of passing |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
849 in additional information needed to instantiate some object. For fonts, |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
850 it's a cons of (CHARSET . SECOND-STAGE-P). SECOND-STAGE-P, if set, |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
851 means "try harder to find an appropriate font" and is a very bogus way |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
852 of dealing with the fact that it may not be possible to may a charset |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
853 directly onto a font; it's used esp. under Windows. @@#### We need to |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
854 change this so that MATCHSPEC is just a character. |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
855 |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
856 When redisplay is building up its structure, and needs font info, it |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
857 calls functions in faces.c such as ensure_face_cachel_complete() (map |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
858 fonts needed for a string of text) or |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
859 ensure_face_cachel_contains_charset() (map fonts needed for a charset |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
860 derived from a single character). The former function calls the latter; |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
861 the latter calls face_property_matching_instance(); this constructs the |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
862 MATCHSPEC and calls specifier_instance_no_quit() twice (first stage and |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
863 second stage, updating MATCHSPEC appropriately). That function, in |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
864 turn, looks up the appropriate specifier method to do the instantiation, |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
865 which, lo and behold, is this function here (because we set it in |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
866 initialization using `SPECIFIER_HAS_METHOD (font, instantiate);'). We |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
867 in turn call the device method `find_charset_font', which maps to |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
868 mswindows_find_charset_font(), x_find_charset_font(), or similar, in |
|
5176
8b2f75cecb89
rename objects* (.c, .h and .el files) to fontcolor*
Ben Wing <ben@xemacs.org>
parents:
5015
diff
changeset
|
869 fontcolor-msw.c or the like. |
|
5015
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
870 |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
871 --ben */ |
| 874 | 872 |
| 428 | 873 static Lisp_Object |
| 2333 | 874 font_instantiate (Lisp_Object UNUSED (specifier), |
| 875 Lisp_Object USED_IF_MULE (matchspec), | |
| 428 | 876 Lisp_Object domain, Lisp_Object instantiator, |
|
4426
515b91f904c1
Fix specifier inheritance behavior
Didier Verna <didier@xemacs.org>
parents:
3659
diff
changeset
|
877 Lisp_Object depth, int no_fallback) |
| 428 | 878 { |
| 879 /* When called, we're inside of call_with_suspended_errors(), | |
| 880 so we can freely error. */ | |
| 442 | 881 Lisp_Object device = DOMAIN_DEVICE (domain); |
| 428 | 882 struct device *d = XDEVICE (device); |
| 883 Lisp_Object instance; | |
| 872 | 884 Lisp_Object charset = Qnil; |
| 1204 | 885 #ifdef MULE |
|
5015
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
886 enum font_specifier_matchspec_stages stage = STAGE_INITIAL; |
| 428 | 887 |
| 888 if (!UNBOUNDP (matchspec)) | |
| 872 | 889 { |
| 890 charset = Fget_charset (XCAR (matchspec)); | |
| 3659 | 891 |
|
5015
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
892 #define FROB(new_stage, enumstage) \ |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
893 if (EQ(Q##new_stage, XCDR(matchspec))) \ |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
894 { \ |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
895 stage = enumstage; \ |
| 3659 | 896 } |
| 897 | |
|
5015
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
898 FROB (initial, STAGE_INITIAL) |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
899 else FROB (final, STAGE_FINAL) |
| 3659 | 900 else assert(0); |
| 901 | |
| 902 #undef FROB | |
| 903 | |
| 872 | 904 } |
| 428 | 905 #endif |
| 906 | |
| 907 if (FONT_INSTANCEP (instantiator)) | |
| 908 { | |
| 909 if (NILP (device) | |
|
4426
515b91f904c1
Fix specifier inheritance behavior
Didier Verna <didier@xemacs.org>
parents:
3659
diff
changeset
|
910 || EQ (device, XFONT_INSTANCE (instantiator)->device)) |
| 428 | 911 { |
| 912 #ifdef MULE | |
| 872 | 913 if (font_spec_matches_charset (d, charset, 0, |
| 428 | 914 Ffont_instance_truename |
| 915 (instantiator), | |
| 872 | 916 0, -1, stage)) |
| 1204 | 917 #endif |
| 428 | 918 return instantiator; |
| 919 } | |
| 920 instantiator = Ffont_instance_name (instantiator); | |
| 921 } | |
| 922 | |
| 923 if (STRINGP (instantiator)) | |
| 924 { | |
| 874 | 925 #ifdef MULE |
| 3659 | 926 /* #### rename these caches. */ |
|
5015
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
927 Lisp_Object cache = stage == STAGE_FINAL ? |
|
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
928 d->charset_font_cache_stage_2 : |
|
4426
515b91f904c1
Fix specifier inheritance behavior
Didier Verna <didier@xemacs.org>
parents:
3659
diff
changeset
|
929 d->charset_font_cache_stage_1; |
| 874 | 930 #else |
| 931 Lisp_Object cache = d->font_instance_cache; | |
| 932 #endif | |
| 872 | 933 |
| 428 | 934 #ifdef MULE |
| 872 | 935 if (!NILP (charset)) |
| 428 | 936 { |
| 937 /* The instantiator is a font spec that could match many | |
| 938 different fonts. We need to find one of those fonts | |
| 939 whose registry matches the registry of the charset in | |
| 940 MATCHSPEC. This is potentially a very slow operation, | |
| 941 as it involves doing an XListFonts() or equivalent to | |
| 942 iterate over all possible fonts, and a regexp match | |
| 943 on each one. So we cache the results. */ | |
| 944 Lisp_Object matching_font = Qunbound; | |
| 872 | 945 Lisp_Object hash_table = Fgethash (charset, cache, Qunbound); |
| 428 | 946 if (UNBOUNDP (hash_table)) |
| 947 { | |
| 948 /* need to make a sub hash table. */ | |
| 949 hash_table = make_lisp_hash_table (20, HASH_TABLE_KEY_WEAK, | |
|
5191
71ee43b8a74d
Add #'equalp as a hash test by default; add #'define-hash-table-test, GNU API
Aidan Kehoe <kehoea@parhasard.net>
parents:
5178
diff
changeset
|
950 Qequal); |
| 872 | 951 Fputhash (charset, hash_table, cache); |
| 428 | 952 } |
| 953 else | |
| 954 matching_font = Fgethash (instantiator, hash_table, Qunbound); | |
| 955 | |
| 956 if (UNBOUNDP (matching_font)) | |
| 957 { | |
| 958 /* make sure we cache the failures, too. */ | |
| 959 matching_font = | |
|
4426
515b91f904c1
Fix specifier inheritance behavior
Didier Verna <didier@xemacs.org>
parents:
3659
diff
changeset
|
960 DEVMETH_OR_GIVEN (d, find_charset_font, |
|
515b91f904c1
Fix specifier inheritance behavior
Didier Verna <didier@xemacs.org>
parents:
3659
diff
changeset
|
961 (device, instantiator, charset, stage), |
|
515b91f904c1
Fix specifier inheritance behavior
Didier Verna <didier@xemacs.org>
parents:
3659
diff
changeset
|
962 instantiator); |
| 428 | 963 Fputhash (instantiator, matching_font, hash_table); |
| 964 } | |
| 965 if (NILP (matching_font)) | |
| 966 return Qunbound; | |
| 967 instantiator = matching_font; | |
| 968 } | |
| 969 #endif /* MULE */ | |
| 970 | |
| 971 /* First, look to see if we can retrieve a cached value. */ | |
| 872 | 972 instance = Fgethash (instantiator, cache, Qunbound); |
| 428 | 973 /* Otherwise, make a new one. */ |
| 974 if (UNBOUNDP (instance)) | |
| 975 { | |
| 976 /* make sure we cache the failures, too. */ | |
| 3094 | 977 instance = Fmake_font_instance (instantiator, device, Qt, charset); |
| 872 | 978 Fputhash (instantiator, instance, cache); |
| 428 | 979 } |
| 980 | |
| 981 return NILP (instance) ? Qunbound : instance; | |
| 982 } | |
| 983 else if (VECTORP (instantiator)) | |
| 984 { | |
| 3659 | 985 Lisp_Object match_inst = Qunbound; |
| 428 | 986 assert (XVECTOR_LENGTH (instantiator) == 1); |
| 3659 | 987 |
| 988 match_inst = face_property_matching_instance | |
| 989 (Fget_face (XVECTOR_DATA (instantiator)[0]), Qfont, | |
|
5015
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
990 charset, domain, ERROR_ME, no_fallback, depth, STAGE_INITIAL); |
| 3659 | 991 |
|
4426
515b91f904c1
Fix specifier inheritance behavior
Didier Verna <didier@xemacs.org>
parents:
3659
diff
changeset
|
992 if (UNBOUNDP(match_inst)) |
| 3659 | 993 { |
| 994 match_inst = face_property_matching_instance | |
| 995 (Fget_face (XVECTOR_DATA (instantiator)[0]), Qfont, | |
|
5015
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
996 charset, domain, ERROR_ME, no_fallback, depth, STAGE_FINAL); |
| 3659 | 997 } |
| 998 | |
| 999 return match_inst; | |
| 1000 | |
| 428 | 1001 } |
| 1002 else if (NILP (instantiator)) | |
| 1003 return Qunbound; | |
| 1004 else | |
| 2500 | 1005 ABORT (); /* Eh? */ |
| 428 | 1006 |
| 1007 return Qunbound; | |
| 1008 } | |
| 1009 | |
| 1010 static void | |
| 1011 font_validate (Lisp_Object instantiator) | |
| 1012 { | |
| 1013 if (FONT_INSTANCEP (instantiator) || STRINGP (instantiator)) | |
| 1014 return; | |
| 1015 if (VECTORP (instantiator)) | |
| 1016 { | |
| 1017 if (XVECTOR_LENGTH (instantiator) != 1) | |
| 1018 { | |
| 563 | 1019 sferror |
| 428 | 1020 ("Vector length must be one for font inheritance", instantiator); |
| 1021 } | |
| 1022 Fget_face (XVECTOR_DATA (instantiator)[0]); | |
| 1023 } | |
| 1024 else | |
| 563 | 1025 invalid_argument ("Must be string, vector, or font-instance", |
| 428 | 1026 instantiator); |
| 1027 } | |
| 1028 | |
| 1029 static void | |
| 1030 font_after_change (Lisp_Object specifier, Lisp_Object locale) | |
| 1031 { | |
| 1032 Lisp_Object face = FONT_SPECIFIER_FACE (XFONT_SPECIFIER (specifier)); | |
| 1033 Lisp_Object property = | |
| 1034 FONT_SPECIFIER_FACE_PROPERTY (XFONT_SPECIFIER (specifier)); | |
| 1035 if (!NILP (face)) | |
| 448 | 1036 { |
| 1037 face_property_was_changed (face, property, locale); | |
| 1038 if (BUFFERP (locale)) | |
| 1039 XBUFFER (locale)->buffer_local_face_property = 1; | |
| 1040 } | |
| 428 | 1041 } |
| 1042 | |
| 1043 void | |
| 1044 set_font_attached_to (Lisp_Object obj, Lisp_Object face, Lisp_Object property) | |
| 1045 { | |
| 440 | 1046 Lisp_Specifier *font = XFONT_SPECIFIER (obj); |
| 428 | 1047 |
| 1048 FONT_SPECIFIER_FACE (font) = face; | |
| 1049 FONT_SPECIFIER_FACE_PROPERTY (font) = property; | |
| 1050 } | |
| 1051 | |
| 1052 DEFUN ("font-specifier-p", Ffont_specifier_p, 1, 1, 0, /* | |
| 1053 Return non-nil if OBJECT is a font specifier. | |
| 1054 | |
| 442 | 1055 See `make-font-specifier' for a description of possible font instantiators. |
| 428 | 1056 */ |
| 1057 (object)) | |
| 1058 { | |
| 1059 return FONT_SPECIFIERP (object) ? Qt : Qnil; | |
| 1060 } | |
| 1061 | |
| 1062 | |
| 1063 /***************************************************************************** | |
| 1064 Face Boolean Object | |
| 1065 ****************************************************************************/ | |
| 1204 | 1066 |
| 1067 static const struct memory_description face_boolean_specifier_description[] = { | |
| 1068 { XD_LISP_OBJECT, offsetof (struct face_boolean_specifier, face) }, | |
| 1069 { XD_LISP_OBJECT, offsetof (struct face_boolean_specifier, face_property) }, | |
| 1070 { XD_END } | |
| 1071 }; | |
| 1072 | |
| 1073 DEFINE_SPECIFIER_TYPE_WITH_DATA (face_boolean); | |
| 428 | 1074 Lisp_Object Qface_boolean; |
| 1075 | |
| 1076 static void | |
| 1077 face_boolean_create (Lisp_Object obj) | |
| 1078 { | |
| 440 | 1079 Lisp_Specifier *face_boolean = XFACE_BOOLEAN_SPECIFIER (obj); |
| 428 | 1080 |
| 1081 FACE_BOOLEAN_SPECIFIER_FACE (face_boolean) = Qnil; | |
| 1082 FACE_BOOLEAN_SPECIFIER_FACE_PROPERTY (face_boolean) = Qnil; | |
| 1083 } | |
| 1084 | |
| 1085 static void | |
| 1086 face_boolean_mark (Lisp_Object obj) | |
| 1087 { | |
| 440 | 1088 Lisp_Specifier *face_boolean = XFACE_BOOLEAN_SPECIFIER (obj); |
| 428 | 1089 |
| 1090 mark_object (FACE_BOOLEAN_SPECIFIER_FACE (face_boolean)); | |
| 1091 mark_object (FACE_BOOLEAN_SPECIFIER_FACE_PROPERTY (face_boolean)); | |
| 1092 } | |
| 1093 | |
| 1094 /* No equal or hash methods; ignore the face the face-boolean is based off | |
| 1095 of for `equal' */ | |
| 1096 | |
| 1097 static Lisp_Object | |
| 2286 | 1098 face_boolean_instantiate (Lisp_Object specifier, |
| 1099 Lisp_Object UNUSED (matchspec), | |
| 428 | 1100 Lisp_Object domain, Lisp_Object instantiator, |
|
4426
515b91f904c1
Fix specifier inheritance behavior
Didier Verna <didier@xemacs.org>
parents:
3659
diff
changeset
|
1101 Lisp_Object depth, int no_fallback) |
| 428 | 1102 { |
| 1103 /* When called, we're inside of call_with_suspended_errors(), | |
| 1104 so we can freely error. */ | |
| 1105 if (NILP (instantiator) || EQ (instantiator, Qt)) | |
| 1106 return instantiator; | |
| 1107 else if (VECTORP (instantiator)) | |
| 1108 { | |
| 1109 Lisp_Object retval; | |
| 1110 Lisp_Object prop; | |
| 1111 int instantiator_len = XVECTOR_LENGTH (instantiator); | |
| 1112 | |
| 1113 assert (instantiator_len >= 1 && instantiator_len <= 3); | |
| 1114 if (instantiator_len > 1) | |
| 1115 prop = XVECTOR_DATA (instantiator)[1]; | |
| 1116 else | |
| 1117 { | |
| 1118 if (NILP (FACE_BOOLEAN_SPECIFIER_FACE | |
| 1119 (XFACE_BOOLEAN_SPECIFIER (specifier)))) | |
| 563 | 1120 gui_error |
| 428 | 1121 ("Face-boolean specifier not attached to a face", instantiator); |
| 1122 prop = FACE_BOOLEAN_SPECIFIER_FACE_PROPERTY | |
| 1123 (XFACE_BOOLEAN_SPECIFIER (specifier)); | |
| 1124 } | |
| 1125 | |
| 1126 retval = (FACE_PROPERTY_INSTANCE_1 | |
| 1127 (Fget_face (XVECTOR_DATA (instantiator)[0]), | |
|
4426
515b91f904c1
Fix specifier inheritance behavior
Didier Verna <didier@xemacs.org>
parents:
3659
diff
changeset
|
1128 prop, domain, ERROR_ME, no_fallback, depth)); |
| 428 | 1129 |
| 1130 if (instantiator_len == 3 && !NILP (XVECTOR_DATA (instantiator)[2])) | |
| 1131 retval = NILP (retval) ? Qt : Qnil; | |
| 1132 | |
| 1133 return retval; | |
| 1134 } | |
| 1135 else | |
| 2500 | 1136 ABORT (); /* Eh? */ |
| 428 | 1137 |
| 1138 return Qunbound; | |
| 1139 } | |
| 1140 | |
| 1141 static void | |
| 1142 face_boolean_validate (Lisp_Object instantiator) | |
| 1143 { | |
| 1144 if (NILP (instantiator) || EQ (instantiator, Qt)) | |
| 1145 return; | |
| 1146 else if (VECTORP (instantiator) && | |
| 1147 (XVECTOR_LENGTH (instantiator) >= 1 && | |
| 1148 XVECTOR_LENGTH (instantiator) <= 3)) | |
| 1149 { | |
| 1150 Lisp_Object face = XVECTOR_DATA (instantiator)[0]; | |
| 1151 | |
| 1152 Fget_face (face); | |
| 1153 | |
| 1154 if (XVECTOR_LENGTH (instantiator) > 1) | |
| 1155 { | |
| 1156 Lisp_Object field = XVECTOR_DATA (instantiator)[1]; | |
| 1157 if (!EQ (field, Qunderline) | |
| 1158 && !EQ (field, Qstrikethru) | |
| 1159 && !EQ (field, Qhighlight) | |
| 1160 && !EQ (field, Qdim) | |
| 1161 && !EQ (field, Qblinking) | |
| 1162 && !EQ (field, Qreverse)) | |
| 563 | 1163 invalid_constant ("Invalid face-boolean inheritance field", |
| 428 | 1164 field); |
| 1165 } | |
| 1166 } | |
| 1167 else if (VECTORP (instantiator)) | |
| 563 | 1168 sferror ("Wrong length for face-boolean inheritance spec", |
| 428 | 1169 instantiator); |
| 1170 else | |
| 563 | 1171 invalid_argument ("Face-boolean instantiator must be nil, t, or vector", |
| 428 | 1172 instantiator); |
| 1173 } | |
| 1174 | |
| 1175 static void | |
| 1176 face_boolean_after_change (Lisp_Object specifier, Lisp_Object locale) | |
| 1177 { | |
| 1178 Lisp_Object face = | |
| 1179 FACE_BOOLEAN_SPECIFIER_FACE (XFACE_BOOLEAN_SPECIFIER (specifier)); | |
| 1180 Lisp_Object property = | |
| 1181 FACE_BOOLEAN_SPECIFIER_FACE_PROPERTY (XFACE_BOOLEAN_SPECIFIER (specifier)); | |
| 1182 if (!NILP (face)) | |
| 448 | 1183 { |
| 1184 face_property_was_changed (face, property, locale); | |
| 1185 if (BUFFERP (locale)) | |
| 1186 XBUFFER (locale)->buffer_local_face_property = 1; | |
| 1187 } | |
| 428 | 1188 } |
| 1189 | |
| 1190 void | |
| 1191 set_face_boolean_attached_to (Lisp_Object obj, Lisp_Object face, | |
| 1192 Lisp_Object property) | |
| 1193 { | |
| 440 | 1194 Lisp_Specifier *face_boolean = XFACE_BOOLEAN_SPECIFIER (obj); |
| 428 | 1195 |
| 1196 FACE_BOOLEAN_SPECIFIER_FACE (face_boolean) = face; | |
| 1197 FACE_BOOLEAN_SPECIFIER_FACE_PROPERTY (face_boolean) = property; | |
| 1198 } | |
| 1199 | |
| 1200 DEFUN ("face-boolean-specifier-p", Fface_boolean_specifier_p, 1, 1, 0, /* | |
| 1201 Return non-nil if OBJECT is a face-boolean specifier. | |
| 1202 | |
| 442 | 1203 See `make-face-boolean-specifier' for a description of possible |
| 1204 face-boolean instantiators. | |
| 428 | 1205 */ |
| 1206 (object)) | |
| 1207 { | |
| 1208 return FACE_BOOLEAN_SPECIFIERP (object) ? Qt : Qnil; | |
| 1209 } | |
| 1210 | |
| 1211 | |
|
5080
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1212 /***************************************************************************** |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1213 Face Background Placement Object |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1214 ****************************************************************************/ |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1215 Lisp_Object Qabsolute, Qrelative; |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1216 |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1217 static const struct memory_description |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1218 face_background_placement_specifier_description[] = { |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1219 { XD_LISP_OBJECT, offsetof (struct face_background_placement_specifier, |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1220 face) }, |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1221 { XD_END } |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1222 }; |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1223 |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1224 DEFINE_SPECIFIER_TYPE_WITH_DATA (face_background_placement); |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1225 Lisp_Object Qface_background_placement; |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1226 |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1227 static void |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1228 face_background_placement_create (Lisp_Object obj) |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1229 { |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1230 Lisp_Specifier *face_background_placement |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1231 = XFACE_BACKGROUND_PLACEMENT_SPECIFIER (obj); |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1232 |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1233 FACE_BACKGROUND_PLACEMENT_SPECIFIER_FACE (face_background_placement) = Qnil; |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1234 } |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1235 |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1236 static void |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1237 face_background_placement_mark (Lisp_Object obj) |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1238 { |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1239 Lisp_Specifier *face_background_placement |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1240 = XFACE_BACKGROUND_PLACEMENT_SPECIFIER (obj); |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1241 |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1242 mark_object |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1243 (FACE_BACKGROUND_PLACEMENT_SPECIFIER_FACE (face_background_placement)); |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1244 } |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1245 |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1246 /* No equal or hash methods; ignore the face the background-placement is based |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1247 off of for `equal' */ |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1248 |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1249 extern Lisp_Object Qbackground_placement; |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1250 |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1251 static Lisp_Object |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1252 face_background_placement_instantiate (Lisp_Object UNUSED (specifier), |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1253 Lisp_Object UNUSED (matchspec), |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1254 Lisp_Object domain, |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1255 Lisp_Object instantiator, |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1256 Lisp_Object depth, |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1257 int no_fallback) |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1258 { |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1259 /* When called, we're inside of call_with_suspended_errors(), |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1260 so we can freely error. */ |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1261 if (EQ (instantiator, Qabsolute) || EQ (instantiator, Qrelative)) |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1262 return instantiator; |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1263 else if (VECTORP (instantiator)) |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1264 { |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1265 assert (XVECTOR_LENGTH (instantiator) == 1); |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1266 |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1267 return FACE_PROPERTY_INSTANCE_1 |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1268 (Fget_face (XVECTOR_DATA (instantiator)[0]), |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1269 Qbackground_placement, domain, ERROR_ME, no_fallback, depth); |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1270 } |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1271 else |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1272 ABORT (); /* Eh? */ |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1273 |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1274 return Qunbound; |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1275 } |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1276 |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1277 static void |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1278 face_background_placement_validate (Lisp_Object instantiator) |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1279 { |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1280 if (EQ (instantiator, Qabsolute) || EQ (instantiator, Qrelative)) |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1281 return; |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1282 else if (VECTORP (instantiator) && |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1283 (XVECTOR_LENGTH (instantiator) == 1)) |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1284 { |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1285 Lisp_Object face = XVECTOR_DATA (instantiator)[0]; |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1286 |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1287 Fget_face (face); /* just to check that the face exists -- dvl */ |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1288 } |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1289 else if (VECTORP (instantiator)) |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1290 sferror ("Wrong length for background-placement inheritance spec", |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1291 instantiator); |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1292 else |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1293 invalid_argument |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1294 ("\ |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1295 Background-placement instantiator must be absolute, relative or vector", |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1296 instantiator); |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1297 } |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1298 |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1299 static void |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1300 face_background_placement_after_change (Lisp_Object specifier, |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1301 Lisp_Object locale) |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1302 { |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1303 Lisp_Object face |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1304 = FACE_BACKGROUND_PLACEMENT_SPECIFIER_FACE |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1305 (XFACE_BACKGROUND_PLACEMENT_SPECIFIER (specifier)); |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1306 |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1307 if (!NILP (face)) |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1308 { |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1309 face_property_was_changed (face, Qbackground_placement, locale); |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1310 if (BUFFERP (locale)) |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1311 XBUFFER (locale)->buffer_local_face_property = 1; |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1312 } |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1313 } |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1314 |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1315 void |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1316 set_face_background_placement_attached_to (Lisp_Object obj, Lisp_Object face) |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1317 { |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1318 Lisp_Specifier *face_background_placement |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1319 = XFACE_BACKGROUND_PLACEMENT_SPECIFIER (obj); |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1320 |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1321 FACE_BACKGROUND_PLACEMENT_SPECIFIER_FACE (face_background_placement) = face; |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1322 } |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1323 |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1324 DEFUN ("face-background-placement-specifier-p", Fface_background_placement_specifier_p, 1, 1, 0, /* |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1325 Return non-nil if OBJECT is a face-background-placement specifier. |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1326 |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1327 See `make-face-background-placement-specifier' for a description of possible |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1328 face-background-placement instantiators. |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1329 */ |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1330 (object)) |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1331 { |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1332 return FACE_BACKGROUND_PLACEMENT_SPECIFIERP (object) ? Qt : Qnil; |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1333 } |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1334 |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1335 |
| 428 | 1336 /************************************************************************/ |
| 1337 /* initialization */ | |
| 1338 /************************************************************************/ | |
| 1339 | |
| 1340 void | |
|
5176
8b2f75cecb89
rename objects* (.c, .h and .el files) to fontcolor*
Ben Wing <ben@xemacs.org>
parents:
5015
diff
changeset
|
1341 syms_of_fontcolor (void) |
| 428 | 1342 { |
|
5117
3742ea8250b5
Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents:
3017
diff
changeset
|
1343 INIT_LISP_OBJECT (color_instance); |
|
3742ea8250b5
Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents:
3017
diff
changeset
|
1344 INIT_LISP_OBJECT (font_instance); |
| 442 | 1345 |
| 428 | 1346 DEFSUBR (Fcolor_specifier_p); |
| 1347 DEFSUBR (Ffont_specifier_p); | |
| 1348 DEFSUBR (Fface_boolean_specifier_p); | |
|
5080
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1349 DEFSUBR (Fface_background_placement_specifier_p); |
| 428 | 1350 |
| 563 | 1351 DEFSYMBOL_MULTIWORD_PREDICATE (Qcolor_instancep); |
| 428 | 1352 DEFSUBR (Fmake_color_instance); |
| 1353 DEFSUBR (Fcolor_instance_p); | |
| 1354 DEFSUBR (Fcolor_instance_name); | |
| 1355 DEFSUBR (Fcolor_instance_rgb_components); | |
| 1356 DEFSUBR (Fvalid_color_name_p); | |
| 2527 | 1357 DEFSUBR (Fcolor_list); |
| 428 | 1358 |
| 563 | 1359 DEFSYMBOL_MULTIWORD_PREDICATE (Qfont_instancep); |
| 428 | 1360 DEFSUBR (Fmake_font_instance); |
| 1361 DEFSUBR (Ffont_instance_p); | |
| 1362 DEFSUBR (Ffont_instance_name); | |
| 1363 DEFSUBR (Ffont_instance_ascent); | |
| 1364 DEFSUBR (Ffont_instance_descent); | |
| 1365 DEFSUBR (Ffont_instance_width); | |
| 3094 | 1366 DEFSUBR (Ffont_instance_charset); |
| 428 | 1367 DEFSUBR (Ffont_instance_proportional_p); |
| 1368 DEFSUBR (Ffont_instance_truename); | |
| 1369 DEFSUBR (Ffont_instance_properties); | |
| 2527 | 1370 DEFSUBR (Ffont_list); |
| 428 | 1371 |
| 1372 /* Qcolor, Qfont defined in general.c */ | |
| 563 | 1373 DEFSYMBOL (Qface_boolean); |
|
5080
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1374 |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1375 DEFSYMBOL (Qface_background_placement); |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1376 DEFSYMBOL (Qabsolute); |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1377 DEFSYMBOL (Qrelative); |
| 428 | 1378 } |
| 1379 | |
| 1380 void | |
|
5176
8b2f75cecb89
rename objects* (.c, .h and .el files) to fontcolor*
Ben Wing <ben@xemacs.org>
parents:
5015
diff
changeset
|
1381 specifier_type_create_fontcolor (void) |
| 428 | 1382 { |
| 1383 INITIALIZE_SPECIFIER_TYPE_WITH_DATA (color, "color", "color-specifier-p"); | |
| 1384 INITIALIZE_SPECIFIER_TYPE_WITH_DATA (font, "font", "font-specifier-p"); | |
| 1385 INITIALIZE_SPECIFIER_TYPE_WITH_DATA (face_boolean, "face-boolean", | |
| 1386 "face-boolean-specifier-p"); | |
|
5080
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1387 INITIALIZE_SPECIFIER_TYPE_WITH_DATA (face_background_placement, |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1388 "face-background-placement", |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1389 "\ |
|
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1390 face-background-placement-specifier-p"); |
| 428 | 1391 |
| 1392 SPECIFIER_HAS_METHOD (color, instantiate); | |
| 1393 SPECIFIER_HAS_METHOD (font, instantiate); | |
| 1394 SPECIFIER_HAS_METHOD (face_boolean, instantiate); | |
|
5080
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1395 SPECIFIER_HAS_METHOD (face_background_placement, instantiate); |
| 428 | 1396 |
| 1397 SPECIFIER_HAS_METHOD (color, validate); | |
| 1398 SPECIFIER_HAS_METHOD (font, validate); | |
| 1399 SPECIFIER_HAS_METHOD (face_boolean, validate); | |
|
5080
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1400 SPECIFIER_HAS_METHOD (face_background_placement, validate); |
| 428 | 1401 |
| 1402 SPECIFIER_HAS_METHOD (color, create); | |
| 1403 SPECIFIER_HAS_METHOD (font, create); | |
| 1404 SPECIFIER_HAS_METHOD (face_boolean, create); | |
|
5080
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1405 SPECIFIER_HAS_METHOD (face_background_placement, create); |
| 428 | 1406 |
| 1407 SPECIFIER_HAS_METHOD (color, mark); | |
| 1408 SPECIFIER_HAS_METHOD (font, mark); | |
| 1409 SPECIFIER_HAS_METHOD (face_boolean, mark); | |
|
5080
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1410 SPECIFIER_HAS_METHOD (face_background_placement, mark); |
| 428 | 1411 |
| 1412 SPECIFIER_HAS_METHOD (color, after_change); | |
| 1413 SPECIFIER_HAS_METHOD (font, after_change); | |
| 1414 SPECIFIER_HAS_METHOD (face_boolean, after_change); | |
|
5080
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1415 SPECIFIER_HAS_METHOD (face_background_placement, after_change); |
| 428 | 1416 |
| 1417 #ifdef MULE | |
| 1418 SPECIFIER_HAS_METHOD (font, validate_matchspec); | |
| 1419 #endif | |
| 1420 } | |
| 1421 | |
| 1422 void | |
|
5176
8b2f75cecb89
rename objects* (.c, .h and .el files) to fontcolor*
Ben Wing <ben@xemacs.org>
parents:
5015
diff
changeset
|
1423 reinit_specifier_type_create_fontcolor (void) |
| 428 | 1424 { |
| 1425 REINITIALIZE_SPECIFIER_TYPE (color); | |
| 1426 REINITIALIZE_SPECIFIER_TYPE (font); | |
| 1427 REINITIALIZE_SPECIFIER_TYPE (face_boolean); | |
|
5080
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
5015
diff
changeset
|
1428 REINITIALIZE_SPECIFIER_TYPE (face_background_placement); |
| 428 | 1429 } |
| 1430 | |
| 1431 void | |
|
5176
8b2f75cecb89
rename objects* (.c, .h and .el files) to fontcolor*
Ben Wing <ben@xemacs.org>
parents:
5015
diff
changeset
|
1432 reinit_vars_of_fontcolor (void) |
| 428 | 1433 { |
| 1434 { | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
1435 Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (color_instance); |
|
5117
3742ea8250b5
Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents:
3017
diff
changeset
|
1436 Lisp_Color_Instance *c = XCOLOR_INSTANCE (obj); |
| 428 | 1437 c->name = Qnil; |
| 1438 c->device = Qnil; | |
| 1439 c->data = 0; | |
| 1440 | |
|
5117
3742ea8250b5
Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents:
3017
diff
changeset
|
1441 Vthe_null_color_instance = obj; |
|
3742ea8250b5
Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents:
3017
diff
changeset
|
1442 staticpro_nodump (&Vthe_null_color_instance); |
| 428 | 1443 } |
| 1444 | |
| 1445 { | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
1446 Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (font_instance); |
|
5117
3742ea8250b5
Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents:
3017
diff
changeset
|
1447 Lisp_Font_Instance *f = XFONT_INSTANCE (obj); |
| 428 | 1448 f->name = Qnil; |
| 872 | 1449 f->truename = Qnil; |
| 428 | 1450 f->device = Qnil; |
| 1451 f->data = 0; | |
| 1452 | |
| 1453 f->ascent = f->height = 0; | |
| 1454 f->descent = 0; | |
| 1455 f->width = 0; | |
| 1456 f->proportional_p = 0; | |
| 1457 | |
|
5117
3742ea8250b5
Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents:
3017
diff
changeset
|
1458 Vthe_null_font_instance = obj; |
|
3742ea8250b5
Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents:
3017
diff
changeset
|
1459 staticpro_nodump (&Vthe_null_font_instance); |
| 428 | 1460 } |
| 1461 } | |
| 1462 | |
| 1463 void | |
|
5176
8b2f75cecb89
rename objects* (.c, .h and .el files) to fontcolor*
Ben Wing <ben@xemacs.org>
parents:
5015
diff
changeset
|
1464 vars_of_fontcolor (void) |
| 428 | 1465 { |
| 1466 } |
