Mercurial > hg > xemacs-beta
comparison lisp/x-faces.el @ 263:727739f917cb r20-5b30
Import from CVS: tag r20-5b30
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:24:41 +0200 |
parents | 0e522484dd2a |
children | 8efd647ea9ca |
comparison
equal
deleted
inserted
replaced
262:9d8607af9e13 | 263:727739f917cb |
---|---|
417 ;; I think these should be called "face.faceForeground" instead of | 417 ;; I think these should be called "face.faceForeground" instead of |
418 ;; "face.attributeForeground", but they're the way they are for | 418 ;; "face.attributeForeground", but they're the way they are for |
419 ;; hysterical reasons. (jwz) | 419 ;; hysterical reasons. (jwz) |
420 | 420 |
421 (let* ((append (if set-anyway nil 'append)) | 421 (let* ((append (if set-anyway nil 'append)) |
422 ;; Some faces are initialized before XEmacs is dumped. | |
423 ;; In order for the X resources to be able to override | |
424 ;; those settings, such initialization always uses the | |
425 ;; `default' tag. We remove all specifier specs | |
426 ;; containing the `default' tag in the locale before | |
427 ;; adding new specs. | |
428 (tag-set '(default)) | |
429 ;; The tag order matters here. The spec removal | |
430 ;; function uses the list cdrs. We want to remove (x | |
431 ;; default) and (default) specs, not (default x) and (x) | |
432 ;; specs. | |
433 (x-tag-set '(x default)) | |
434 (tty-tag-set '(tty default)) | |
435 (device-class nil) | |
422 (face-sym (face-name face)) | 436 (face-sym (face-name face)) |
423 (name (symbol-name face-sym)) | 437 (name (symbol-name face-sym)) |
424 (fn (x-get-resource-and-maybe-bogosity-check | 438 (fn (x-get-resource-and-maybe-bogosity-check |
425 (concat name ".attributeFont") | 439 (concat name ".attributeFont") |
426 "Face.AttributeFont" | 440 "Face.AttributeFont" |
465 (concat name ".attributeReverse") | 479 (concat name ".attributeReverse") |
466 "Face.AttributeReverse" | 480 "Face.AttributeReverse" |
467 'boolean locale)) | 481 'boolean locale)) |
468 ) | 482 ) |
469 | 483 |
484 (cond ((framep locale) | |
485 (setq device-class (device-class (frame-device locale)))) | |
486 ((devicep locale) | |
487 (setq device-class (device-class locale)))) | |
488 | |
489 (if device-class | |
490 (setq tag-set (cons device-class tag-set) | |
491 x-tag-set (cons device-class x-tag-set) | |
492 tty-tag-set (cons device-class tty-tag-set))) | |
493 | |
470 ;; | 494 ;; |
471 ;; If this is the default face, then any unspecified properties should | 495 ;; If this is the default face, then any unspecified properties should |
472 ;; be defaulted from the global properties. Can't do this for | 496 ;; be defaulted from the global properties. Can't do this for |
473 ;; frames or devices because then, common resource specs like | 497 ;; frames or devices because then, common resource specs like |
474 ;; "*Foreground: black" will have unwanted effects. | 498 ;; "*Foreground: black" will have unwanted effects. |
491 (setq bg (or (x-get-resource | 515 (setq bg (or (x-get-resource |
492 "cursorColor" "CursorColor" 'string locale) bg))) | 516 "cursorColor" "CursorColor" 'string locale) bg))) |
493 ;; #### should issue warnings? I think this should be | 517 ;; #### should issue warnings? I think this should be |
494 ;; done when the instancing actually happens, but I'm not | 518 ;; done when the instancing actually happens, but I'm not |
495 ;; sure how it should actually be dealt with. | 519 ;; sure how it should actually be dealt with. |
496 (if fn | 520 (when fn |
497 (set-face-font face fn locale nil append)) | 521 ;; Always use the x-tag-set to remove specs, since we don't |
522 ;; know whether the predumped face was initialized with an | |
523 ;; 'x tag or not. | |
524 (remove-specifier-specs-matching-tag-set-cdrs (face-font face) | |
525 locale | |
526 x-tag-set) | |
527 (set-face-font face fn locale nil append)) | |
498 ;; Kludge-o-rooni. Set the foreground and background resources for | 528 ;; Kludge-o-rooni. Set the foreground and background resources for |
499 ;; X devices only -- otherwise things tend to get all messed up | 529 ;; X devices only -- otherwise things tend to get all messed up |
500 ;; if you start up an X frame and then later create a TTY frame. | 530 ;; if you start up an X frame and then later create a TTY frame. |
501 (if fg | 531 (when fg |
502 (set-face-foreground face fg locale 'x append)) | 532 (remove-specifier-specs-matching-tag-set-cdrs (face-foreground face) |
503 (if bg | 533 locale |
504 (set-face-background face bg locale 'x append)) | 534 x-tag-set) |
505 (if bgp | 535 (set-face-foreground face fg locale 'x append)) |
506 (set-face-background-pixmap face bgp locale nil append)) | 536 (when bg |
507 (if ulp | 537 (remove-specifier-specs-matching-tag-set-cdrs (face-background face) |
508 (set-face-underline-p face ulp locale nil append)) | 538 locale |
509 (if stp | 539 x-tag-set) |
510 (set-face-strikethru-p face stp locale nil append)) | 540 (set-face-background face bg locale 'x append)) |
511 (if hp | 541 (when bgp |
512 (set-face-highlight-p face hp locale nil append)) | 542 (remove-specifier-specs-matching-tag-set-cdrs (face-background-pixmap |
513 (if dp | 543 face) |
514 (set-face-dim-p face dp locale nil append)) | 544 locale |
515 (if bp | 545 x-tag-set) |
516 (set-face-blinking-p face bp locale nil append)) | 546 (set-face-background-pixmap face bgp locale nil append)) |
517 (if rp | 547 (when ulp |
518 (set-face-reverse-p face rp locale nil append)) | 548 (remove-specifier-specs-matching-tag-set-cdrs (face-underline-p face) |
549 locale | |
550 tty-tag-set) | |
551 (set-face-underline-p face ulp locale nil append)) | |
552 (when stp | |
553 (remove-specifier-specs-matching-tag-set-cdrs (face-strikethru-p face) | |
554 locale | |
555 tty-tag-set) | |
556 (set-face-strikethru-p face stp locale nil append)) | |
557 (when hp | |
558 (remove-specifier-specs-matching-tag-set-cdrs (face-highlight-p face) | |
559 locale | |
560 tty-tag-set) | |
561 (set-face-highlight-p face hp locale nil append)) | |
562 (when dp | |
563 (remove-specifier-specs-matching-tag-set-cdrs (face-dim-p face) | |
564 locale | |
565 tty-tag-set) | |
566 (set-face-dim-p face dp locale nil append)) | |
567 (when bp | |
568 (remove-specifier-specs-matching-tag-set-cdrs (face-blinking-p face) | |
569 locale | |
570 tty-tag-set) | |
571 (set-face-blinking-p face bp locale nil append)) | |
572 (when rp | |
573 (remove-specifier-specs-matching-tag-set-cdrs (face-reverse-p face) | |
574 locale | |
575 tty-tag-set) | |
576 (set-face-reverse-p face rp locale nil append)) | |
519 )) | 577 )) |
520 | 578 |
521 ;; GNU Emacs compatibility. (move to obsolete.el?) | 579 ;; GNU Emacs compatibility. (move to obsolete.el?) |
522 (defalias 'make-face-x-resource-internal 'x-init-face-from-resources) | 580 (defalias 'make-face-x-resource-internal 'x-init-face-from-resources) |
581 | |
582 (defun remove-specifier-specs-matching-tag-set-cdrs (specifier locale tag-set) | |
583 (while tag-set | |
584 (remove-specifier specifier locale tag-set) | |
585 (setq tag-set (cdr tag-set)))) | |
523 | 586 |
524 ;;; x-init-global-faces is responsible for ensuring that the | 587 ;;; x-init-global-faces is responsible for ensuring that the |
525 ;;; default face has some reasonable fallbacks if nothing else is | 588 ;;; default face has some reasonable fallbacks if nothing else is |
526 ;;; specified. | 589 ;;; specified. |
527 ;;; | 590 ;;; |