[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: faces vs. fonts

From: Agreenbl
Subject: Re: faces vs. fonts
Date: Thu, 17 Jan 2002 14:19:25 EST

On Thu, 17 Jan 2002 Eli Zaretskii <address@hidden> wrote:

> Faces in Emacs are frame-specific.  set-face-attribute expects to
> get the frame for which the face is to be changed as its second
> argument.  If the second argument is nil or t instead of a frame,
> set-face-attribute will modify the face on other frames as well;
> "C-h f set-face-attribute RET" will tell the details.

The description of set-face-attribute in edition 2.7
of the elisp manual does not mention the use of t as
a valid frame argument, but the doc string for
set-face-attribute clearly does, as you state.  (I'm
cc-ing bug-lisp-manual so that that discrepancy can be
fixed at some point.)

Unfortunately, neither t, nor nil, nor both fixes my
problem.  Here is a file you can try:
(set-face-attribute 'default nil
            :family "b&h-lucidatypewriter")
(set-face-attribute 'default t
            :family "b&h-lucidatypewriter")

(setq new-frame-1 (make-frame '((name . ""))))
(setq new-frame-2 (make-frame '((name . "new-frame-2"))))

(defun bug-1 ()
  (message "%s %s"
     (face-attribute 'default :family new-frame-1)
         (face-attribute 'default :family new-frame-2)))

(defun bug-2 ()
  (let ((new-frame-3 (make-frame '((name . ""))))
    (new-frame-4 (make-frame '((name . "new-frame-4")))))
    (message "%s %s"
         (face-attribute 'default :family new-frame-3)
         (face-attribute 'default :family new-frame-4))))
Paste the above into bug.el, and start emacs with:
emacs -q -l bug.el

I get two extra frames (three frames total), one of
which is clearly using courier.  Running bug-1 shows
that the two new frames have different families.

Running bug-2 shows another, possibly unrelated bug:
the two frames it creates also have different families,
but the calls to face-attribute don't give the correct
answers.  Manually calling face-attribute after running
bug-2 does give the correct results.  I'm baffled.
(Of course, I'm easily baffled :-)

Thanks for your help!
   Adam Greenblatt address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]