[Top][All Lists]

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

bug#19117: 25.0.50; emacs on x11 chooses different fonts for the same fa

From: Dima Kogan
Subject: bug#19117: 25.0.50; emacs on x11 chooses different fonts for the same face sometimes
Date: Sat, 06 Dec 2014 23:28:34 -0800

Eli Zaretskii <address@hidden> writes:

>> Starting a few months ago (this is a regression) I'm seeing that
>> sometimes Emacs renders some faces with an unrequested (and ugly) font.
> "Sometimes"?  Can it be that it happens when Emacs needs to display
> some character not available in the "non-ugly" font?

No, it's independent of displaying any particular characters, as far as
I can tell. On my machine I can start emacs (with all my .emacs stuff
sadly) and issue

 (face-font "italic")

and it reports the wrong font. Moving windows around fixes it, and makes
it report the correct font.

>> I can usually make it do the right thing by moving Emacs windows around
>> or resizing them, or maybe opening a new Emacs frame.
> ??? Incredible.  You mean, you do all that magic, and the font used
> for some text suddenly changes?  Without killing the buffer with that
> text?

Not 100% sure. The exact sequence to make it recover eludes me, so I'm
not sure if buffers need to be killed or refreshed in any way. Once it
recovers, things look good and (face-font "italic") reports the right

>> Can somebody give me some pointers on how to debug this to make this bug
>> report useful? I see the breakage many times a day every day.
> Put a breakpoint where Emacs loads new fonts, and see who calls that
> code.

I'm digging through the code. It's slow going so far, but I'm getting
more familiar with it. In my init.el I have in my default-frame-alist

 (font . "-adobe-courier-medium-r-*-*-*-80-*-*-m-*-iso8859-1")

I'm looking at realize_x_face() in xfaces.c. When I create a new frame
by pressing C-x 5 2, all the faces get re-realized, and I can see which
fonts are chosen. That function takes in a list of face attributes, and
associates a font with each face. I'm looking at attrs[LFACE_FONT_INDEX]
on input and face->font on output. For most faces, these two values are

 #<font-object "-adobe-courier-medium-r-normal--11-80-100-100-m-60-iso8859-1">

which is correct: we're asking for a particular font and we're getting
it. For many faces, however these values are

 #<font-spec nil adobe courier ## iso8859-1 medium nil normal 11 100 100 60 
((user-spec . "-adobe-courier-medium-r-*-*-*-80-*-*-m-*-iso8859-1"))>
 "-urw-nimbus mono l-regular-o-normal--11-79-100-100-p-70-iso8859-1"


 #<font-spec nil adobe courier ## iso8859-1 medium nil normal 11 100 100 60 
((user-spec . "-adobe-courier-medium-r-*-*-*-80-*-*-m-*-iso8859-1"))>

Here we're requesting a slanted version of the default font. Sometimes
emacs picks the right one (-adobe-courier-medium-o-...), but at other
times it picks the wrong one (-urw-....). The exact set of faces that
get the wrong font varies with each invocation of realize_x_face(), but
there's always at least one wrong one.

That's the only conclusive evidence I have so far, but I'm still looking
into it. Any suggestions welcome.

reply via email to

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