comparison lisp/faces.el @ 3813:5c622d3241b5

* faces.el (make-face-bold, make-face-italic, make-face-bold-italic, make-face-unbold, make-face-unitalic): Always pass the frame parameter to internal-try-face-font; we only want to set the face for this frame. * faces.el (make-face-bold, make-face-italic, make-face-bold-italic, make-face-unbold, make-face-unitalic): Fix error messages.
author Jim Blandy <jimb@redhat.com>
date Thu, 17 Jun 1993 22:59:49 +0000
parents 0bc757649dd7
children 22b4b8fcda3e
comparison
equal deleted inserted replaced
3812:0bc757649dd7 3813:5c622d3241b5
501 (setq font (or (face-font face frame) 501 (setq font (or (face-font face frame)
502 (face-font face t) 502 (face-font face t)
503 (face-font 'default frame) 503 (face-font 'default frame)
504 (cdr (assq 'font (frame-parameters frame))))) 504 (cdr (assq 'font (frame-parameters frame)))))
505 (or (and (setq f2 (x-make-font-bold font)) 505 (or (and (setq f2 (x-make-font-bold font))
506 (internal-try-face-font face f2)) 506 (internal-try-face-font face f2 frame))
507 (and (setq f2 (x-make-font-demibold font)) 507 (and (setq f2 (x-make-font-demibold font))
508 (internal-try-face-font face f2)))) 508 (internal-try-face-font face f2 frame))))
509 (or (not (equal ofont (face-font face))) 509 (or (not (equal ofont (face-font face)))
510 (and (not noerror) 510 (and (not noerror)
511 (error "No %s version of %S" face ofont))))) 511 (error "No bold version of %S" font)))))
512 512
513 (defun make-face-italic (face &optional frame noerror) 513 (defun make-face-italic (face &optional frame noerror)
514 "Make the font of the given face be italic, if possible. 514 "Make the font of the given face be italic, if possible.
515 If NOERROR is non-nil, return nil on failure." 515 If NOERROR is non-nil, return nil on failure."
516 (interactive (list (read-face-name "Make which face italic: "))) 516 (interactive (list (read-face-name "Make which face italic: ")))
525 (setq font (or (face-font face frame) 525 (setq font (or (face-font face frame)
526 (face-font face t) 526 (face-font face t)
527 (face-font 'default frame) 527 (face-font 'default frame)
528 (cdr (assq 'font (frame-parameters frame))))) 528 (cdr (assq 'font (frame-parameters frame)))))
529 (or (and (setq f2 (x-make-font-italic font)) 529 (or (and (setq f2 (x-make-font-italic font))
530 (internal-try-face-font face f2)) 530 (internal-try-face-font face f2 frame))
531 (and (setq f2 (x-make-font-oblique font)) 531 (and (setq f2 (x-make-font-oblique font))
532 (internal-try-face-font face f2)))) 532 (internal-try-face-font face f2 frame))))
533 (or (not (equal ofont (face-font face))) 533 (or (not (equal ofont (face-font face)))
534 (and (not noerror) 534 (and (not noerror)
535 (error "No %s version of %S" face ofont))))) 535 (error "No italic version of %S" font)))))
536 536
537 (defun make-face-bold-italic (face &optional frame noerror) 537 (defun make-face-bold-italic (face &optional frame noerror)
538 "Make the font of the given face be bold and italic, if possible. 538 "Make the font of the given face be bold and italic, if possible.
539 If NOERROR is non-nil, return nil on failure." 539 If NOERROR is non-nil, return nil on failure."
540 (interactive (list (read-face-name "Make which face bold-italic: "))) 540 (interactive (list (read-face-name "Make which face bold-italic: ")))
552 (cdr (assq 'font (frame-parameters frame))))) 552 (cdr (assq 'font (frame-parameters frame)))))
553 (or (and (setq f2 (x-make-font-italic font)) 553 (or (and (setq f2 (x-make-font-italic font))
554 (not (equal font f2)) 554 (not (equal font f2))
555 (setq f3 (x-make-font-bold f2)) 555 (setq f3 (x-make-font-bold f2))
556 (not (equal f2 f3)) 556 (not (equal f2 f3))
557 (internal-try-face-font face f3)) 557 (internal-try-face-font face f3 frame))
558 (and (setq f2 (x-make-font-oblique font)) 558 (and (setq f2 (x-make-font-oblique font))
559 (not (equal font f2)) 559 (not (equal font f2))
560 (setq f3 (x-make-font-bold f2)) 560 (setq f3 (x-make-font-bold f2))
561 (not (equal f2 f3)) 561 (not (equal f2 f3))
562 (internal-try-face-font face f3)) 562 (internal-try-face-font face f3 frame))
563 (and (setq f2 (x-make-font-italic font)) 563 (and (setq f2 (x-make-font-italic font))
564 (not (equal font f2)) 564 (not (equal font f2))
565 (setq f3 (x-make-font-demibold f2)) 565 (setq f3 (x-make-font-demibold f2))
566 (not (equal f2 f3)) 566 (not (equal f2 f3))
567 (internal-try-face-font face f3)) 567 (internal-try-face-font face f3 frame))
568 (and (setq f2 (x-make-font-oblique font)) 568 (and (setq f2 (x-make-font-oblique font))
569 (not (equal font f2)) 569 (not (equal font f2))
570 (setq f3 (x-make-font-demibold f2)) 570 (setq f3 (x-make-font-demibold f2))
571 (not (equal f2 f3)) 571 (not (equal f2 f3))
572 (internal-try-face-font face f3)))) 572 (internal-try-face-font face f3 frame))))
573 (or (not (equal ofont (face-font face))) 573 (or (not (equal ofont (face-font face)))
574 (and (not noerror) 574 (and (not noerror)
575 (error "No %s version of %S" face ofont))))) 575 (error "No bold italic version of %S" font)))))
576 576
577 (defun make-face-unbold (face &optional frame noerror) 577 (defun make-face-unbold (face &optional frame noerror)
578 "Make the font of the given face be non-bold, if possible. 578 "Make the font of the given face be non-bold, 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 non-bold: "))) 580 (interactive (list (read-face-name "Make which face non-bold: ")))
589 (setq font1 (or (face-font face frame) 589 (setq font1 (or (face-font face frame)
590 (face-font face t) 590 (face-font face t)
591 (face-font 'default frame) 591 (face-font 'default frame)
592 (cdr (assq 'font (frame-parameters frame))))) 592 (cdr (assq 'font (frame-parameters frame)))))
593 (setq font (x-make-font-unbold font1)) 593 (setq font (x-make-font-unbold font1))
594 (if font (internal-try-face-font face font))) 594 (if font (internal-try-face-font face font frame)))
595 (or (not (equal ofont (face-font face))) 595 (or (not (equal ofont (face-font face)))
596 (and (not noerror) 596 (and (not noerror)
597 (error "No %s version of %S" face ofont))))) 597 (error "No unbold version of %S" font1)))))
598 598
599 (defun make-face-unitalic (face &optional frame noerror) 599 (defun make-face-unitalic (face &optional frame noerror)
600 "Make the font of the given face be non-italic, if possible. 600 "Make the font of the given face be non-italic, if possible.
601 If NOERROR is non-nil, return nil on failure." 601 If NOERROR is non-nil, return nil on failure."
602 (interactive (list (read-face-name "Make which face non-italic: "))) 602 (interactive (list (read-face-name "Make which face non-italic: ")))
611 (setq font1 (or (face-font face frame) 611 (setq font1 (or (face-font face frame)
612 (face-font face t) 612 (face-font face t)
613 (face-font 'default frame) 613 (face-font 'default frame)
614 (cdr (assq 'font (frame-parameters frame))))) 614 (cdr (assq 'font (frame-parameters frame)))))
615 (setq font (x-make-font-unitalic font1)) 615 (setq font (x-make-font-unitalic font1))
616 (if font (internal-try-face-font face font))) 616 (if font (internal-try-face-font face font frame)))
617 (or (not (equal ofont (face-font face))) 617 (or (not (equal ofont (face-font face)))
618 (and (not noerror) 618 (and (not noerror)
619 (error "No %s version of %S" face ofont))))) 619 (error "No unitalic version of %S" font1)))))
620 620
621 ;;; Make the builtin faces; the C code knows these as faces 0, 1, and 2, 621 ;;; Make the builtin faces; the C code knows these as faces 0, 1, and 2,
622 ;;; respectively, so they must be the first three faces made. 622 ;;; respectively, so they must be the first three faces made.
623 623
624 (defun face-initialize () 624 (defun face-initialize ()