Mercurial > emacs
comparison lisp/faces.el @ 5199:b8b8063551e1
(make-face-unitalic, make-face-unbold, make-face-bold)
(make-face-bold-italic, make-face-italic): If frame is t,
do the special handling only if face-font is a list.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 27 Nov 1993 07:52:47 +0000 |
parents | 36508a7c0a3f |
children | d0fc9207705a |
comparison
equal
deleted
inserted
replaced
5198:1f14aa44c786 | 5199:b8b8063551e1 |
---|---|
502 | 502 |
503 (defun make-face-bold (face &optional frame noerror) | 503 (defun make-face-bold (face &optional frame noerror) |
504 "Make the font of the given face be bold, if possible. | 504 "Make the font of the given face be bold, if possible. |
505 If NOERROR is non-nil, return nil on failure." | 505 If NOERROR is non-nil, return nil on failure." |
506 (interactive (list (read-face-name "Make which face bold: "))) | 506 (interactive (list (read-face-name "Make which face bold: "))) |
507 (if (eq frame t) | 507 (if (and (eq frame t) (listp (face-font face t))) |
508 (set-face-font face (if (memq 'italic (face-font face t)) | 508 (set-face-font face (if (memq 'italic (face-font face t)) |
509 '(bold italic) '(bold)) | 509 '(bold italic) '(bold)) |
510 t) | 510 t) |
511 (let ((ofont (face-font face frame)) | 511 (let ((ofont (face-font face frame)) |
512 font f2) | 512 font f2) |
539 | 539 |
540 (defun make-face-italic (face &optional frame noerror) | 540 (defun make-face-italic (face &optional frame noerror) |
541 "Make the font of the given face be italic, if possible. | 541 "Make the font of the given face be italic, if possible. |
542 If NOERROR is non-nil, return nil on failure." | 542 If NOERROR is non-nil, return nil on failure." |
543 (interactive (list (read-face-name "Make which face italic: "))) | 543 (interactive (list (read-face-name "Make which face italic: "))) |
544 (if (eq frame t) | 544 (if (and (eq frame t) (listp (face-font face t))) |
545 (set-face-font face (if (memq 'bold (face-font face t)) | 545 (set-face-font face (if (memq 'bold (face-font face t)) |
546 '(bold italic) '(italic)) | 546 '(bold italic) '(italic)) |
547 t) | 547 t) |
548 (let ((ofont (face-font face frame)) | 548 (let ((ofont (face-font face frame)) |
549 font f2) | 549 font f2) |
576 | 576 |
577 (defun make-face-bold-italic (face &optional frame noerror) | 577 (defun make-face-bold-italic (face &optional frame noerror) |
578 "Make the font of the given face be bold and italic, if possible. | 578 "Make the font of the given face be bold and italic, if possible. |
579 If NOERROR is non-nil, return nil on failure." | 579 If NOERROR is non-nil, return nil on failure." |
580 (interactive (list (read-face-name "Make which face bold-italic: "))) | 580 (interactive (list (read-face-name "Make which face bold-italic: "))) |
581 (if (eq frame t) | 581 (if (and (eq frame t) (listp (face-font face t))) |
582 (set-face-font face '(bold italic) t) | 582 (set-face-font face '(bold italic) t) |
583 (let ((ofont (face-font face frame)) | 583 (let ((ofont (face-font face frame)) |
584 font) | 584 font) |
585 (if (null frame) | 585 (if (null frame) |
586 (let ((frames (frame-list))) | 586 (let ((frames (frame-list))) |
628 | 628 |
629 (defun make-face-unbold (face &optional frame noerror) | 629 (defun make-face-unbold (face &optional frame noerror) |
630 "Make the font of the given face be non-bold, if possible. | 630 "Make the font of the given face be non-bold, if possible. |
631 If NOERROR is non-nil, return nil on failure." | 631 If NOERROR is non-nil, return nil on failure." |
632 (interactive (list (read-face-name "Make which face non-bold: "))) | 632 (interactive (list (read-face-name "Make which face non-bold: "))) |
633 (if (eq frame t) | 633 (if (and (eq frame t) (listp (face-font face t))) |
634 (set-face-font face (if (memq 'italic (face-font face t)) | 634 (set-face-font face (if (memq 'italic (face-font face t)) |
635 '(italic) nil) | 635 '(italic) nil) |
636 t) | 636 t) |
637 (let ((ofont (face-font face frame)) | 637 (let ((ofont (face-font face frame)) |
638 font font1) | 638 font font1) |
660 | 660 |
661 (defun make-face-unitalic (face &optional frame noerror) | 661 (defun make-face-unitalic (face &optional frame noerror) |
662 "Make the font of the given face be non-italic, if possible. | 662 "Make the font of the given face be non-italic, if possible. |
663 If NOERROR is non-nil, return nil on failure." | 663 If NOERROR is non-nil, return nil on failure." |
664 (interactive (list (read-face-name "Make which face non-italic: "))) | 664 (interactive (list (read-face-name "Make which face non-italic: "))) |
665 (if (eq frame t) | 665 (if (and (eq frame t) (listp (face-font face t))) |
666 (set-face-font face (if (memq 'bold (face-font face t)) | 666 (set-face-font face (if (memq 'bold (face-font face t)) |
667 '(bold) nil) | 667 '(bold) nil) |
668 t) | 668 t) |
669 (let ((ofont (face-font face frame)) | 669 (let ((ofont (face-font face frame)) |
670 font font1) | 670 font font1) |
890 | 890 |
891 ;; Copy the vectors that represent the faces. | 891 ;; Copy the vectors that represent the faces. |
892 ;; Also fill them in from X resources. | 892 ;; Also fill them in from X resources. |
893 (while rest | 893 (while rest |
894 (setcdr (car rest) (copy-sequence (cdr (car rest)))) | 894 (setcdr (car rest) (copy-sequence (cdr (car rest)))) |
895 (if (listp (face-font (cdr (car rest)))) | 895 (condition-case nil |
896 (let ((bold (memq 'bold (face-font (cdr (car rest))))) | 896 (if (listp (face-font (cdr (car rest)))) |
897 (italic (memq 'italic (face-font (cdr (car rest)))))) | 897 (let ((bold (memq 'bold (face-font (cdr (car rest))))) |
898 (if (and bold italic) | 898 (italic (memq 'italic (face-font (cdr (car rest)))))) |
899 (make-face-bold-italic (car (car rest)) frame) | 899 (if (and bold italic) |
900 (if bold | 900 (make-face-bold-italic (car (car rest)) frame) |
901 (make-face-bold (car (car rest)) frame) | 901 (if bold |
902 (if italic | 902 (make-face-bold (car (car rest)) frame) |
903 (make-face-italic (car (car rest)) frame)))))) | 903 (if italic |
904 (make-face-italic (car (car rest)) frame)))))) | |
905 (error nil)) | |
904 (make-face-x-resource-internal (cdr (car rest)) frame t) | 906 (make-face-x-resource-internal (cdr (car rest)) frame t) |
905 (setq rest (cdr rest))) | 907 (setq rest (cdr rest))) |
906 | 908 |
907 (x-initialize-frame-faces frame) | 909 (x-initialize-frame-faces frame) |
908 | 910 |