comparison src/xfaces.c @ 83296:effe22690419

Merged from miles@gnu.org--gnu-2005 (patch 281-285) Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-281 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-282 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-283 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-284 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-285 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-336
author Karoly Lorentey <lorentey@elte.hu>
date Mon, 02 May 2005 14:38:00 +0000
parents ad07ff6e4555 f658c441541a
children 6aee1e9b0bd7
comparison
equal deleted inserted replaced
83295:2d137ca54960 83296:effe22690419
334 alias for another face. Value of the property is the name of 334 alias for another face. Value of the property is the name of
335 the aliased face. */ 335 the aliased face. */
336 336
337 Lisp_Object Qface_alias; 337 Lisp_Object Qface_alias;
338 338
339 extern Lisp_Object Qcircular_list;
340
339 /* Default stipple pattern used on monochrome displays. This stipple 341 /* Default stipple pattern used on monochrome displays. This stipple
340 pattern is used on monochrome displays instead of shades of gray 342 pattern is used on monochrome displays instead of shades of gray
341 for a face background color. See `set-face-stipple' for possible 343 for a face background color. See `set-face-stipple' for possible
342 values for this variable. */ 344 values for this variable. */
343 345
469 struct table_entry; 471 struct table_entry;
470 struct named_merge_point; 472 struct named_merge_point;
471 473
472 static void map_tty_color P_ ((struct frame *, struct face *, 474 static void map_tty_color P_ ((struct frame *, struct face *,
473 enum lface_attribute_index, int *)); 475 enum lface_attribute_index, int *));
474 static Lisp_Object resolve_face_name P_ ((Lisp_Object)); 476 static Lisp_Object resolve_face_name P_ ((Lisp_Object, int));
475 static int may_use_scalable_font_p P_ ((const char *)); 477 static int may_use_scalable_font_p P_ ((const char *));
476 static void set_font_frame_param P_ ((Lisp_Object, Lisp_Object)); 478 static void set_font_frame_param P_ ((Lisp_Object, Lisp_Object));
477 static int better_font_p P_ ((int *, struct font_name *, struct font_name *, 479 static int better_font_p P_ ((int *, struct font_name *, struct font_name *,
478 int, int)); 480 int, int));
479 static int x_face_list_fonts P_ ((struct frame *, char *, 481 static int x_face_list_fonts P_ ((struct frame *, char *,
3218 { 3220 {
3219 return Qnil; 3221 return Qnil;
3220 } 3222 }
3221 3223
3222 /* Resolve face name FACE_NAME. If FACE_NAME is a string, intern it 3224 /* Resolve face name FACE_NAME. If FACE_NAME is a string, intern it
3223 to make it a symvol. If FACE_NAME is an alias for another face, 3225 to make it a symbol. If FACE_NAME is an alias for another face,
3224 return that face's name. */ 3226 return that face's name.
3227
3228 Return default face in case of errors. */
3225 3229
3226 static Lisp_Object 3230 static Lisp_Object
3227 resolve_face_name (face_name) 3231 resolve_face_name (face_name, signal_p)
3228 Lisp_Object face_name; 3232 Lisp_Object face_name;
3229 { 3233 int signal_p;
3230 Lisp_Object aliased; 3234 {
3231 int alias_loop_max = 10; 3235 Lisp_Object orig_face;
3236 Lisp_Object tortoise, hare;
3232 3237
3233 if (STRINGP (face_name)) 3238 if (STRINGP (face_name))
3234 face_name = intern (SDATA (face_name)); 3239 face_name = intern (SDATA (face_name));
3235 3240
3236 while (SYMBOLP (face_name)) 3241 if (NILP (face_name) || !SYMBOLP (face_name))
3237 { 3242 return face_name;
3238 aliased = Fget (face_name, Qface_alias); 3243
3239 if (NILP (aliased)) 3244 orig_face = face_name;
3245 tortoise = hare = face_name;
3246
3247 while (1)
3248 {
3249 face_name = hare;
3250 hare = Fget (hare, Qface_alias);
3251 if (NILP (hare) || !SYMBOLP (hare))
3240 break; 3252 break;
3241 if (--alias_loop_max == 0) 3253
3254 face_name = hare;
3255 hare = Fget (hare, Qface_alias);
3256 if (NILP (hare) || !SYMBOLP (hare))
3242 break; 3257 break;
3243 face_name = aliased; 3258
3259 tortoise = Fget (tortoise, Qface_alias);
3260 if (EQ (hare, tortoise))
3261 {
3262 if (signal_p)
3263 Fsignal (Qcircular_list, Fcons (orig_face, Qnil));
3264 return Qdefault;
3265 }
3244 } 3266 }
3245 3267
3246 return face_name; 3268 return face_name;
3247 } 3269 }
3248 3270
3262 Lisp_Object face_name; 3284 Lisp_Object face_name;
3263 int signal_p; 3285 int signal_p;
3264 { 3286 {
3265 Lisp_Object lface; 3287 Lisp_Object lface;
3266 3288
3267 face_name = resolve_face_name (face_name); 3289 face_name = resolve_face_name (face_name, signal_p);
3268 3290
3269 if (f) 3291 if (f)
3270 lface = assq_no_quit (face_name, f->face_alist); 3292 lface = assq_no_quit (face_name, f->face_alist);
3271 else 3293 else
3272 lface = assq_no_quit (face_name, Vface_new_frame_defaults); 3294 lface = assq_no_quit (face_name, Vface_new_frame_defaults);
3997 int font_related_attr_p = 0; 4019 int font_related_attr_p = 0;
3998 4020
3999 CHECK_SYMBOL (face); 4021 CHECK_SYMBOL (face);
4000 CHECK_SYMBOL (attr); 4022 CHECK_SYMBOL (attr);
4001 4023
4002 face = resolve_face_name (face); 4024 face = resolve_face_name (face, 1);
4003 4025
4004 /* If FRAME is 0, change face on all frames, and change the 4026 /* If FRAME is 0, change face on all frames, and change the
4005 default for new frames. */ 4027 default for new frames. */
4006 if (INTEGERP (frame) && XINT (frame) == 0) 4028 if (INTEGERP (frame) && XINT (frame) == 0)
4007 { 4029 {