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