[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: Fri, 26 Dec 2014 11:43:36 -0800

Jan Dj�rv <address@hidden> writes:

> Den 2014-12-19 23:46, Dima Kogan skrev:
>> The questions for Emacs are:
>> - Should the candidate font list stay consistent as Emacs runs?
>> - Should the candidate font list contain any scalable fonts?
>> The answer to the 1st question is probably "yes". Do you know the answer
>> to the 2nd? I can keep probing if you tell me which observed behavior is
>> wrong.
> The answer to the first one is no.  Or rather, it is out of Emacs control.
> Since you are using non-client fonts, the list is determined by the X- or 
> font-server.  The fact that you can get two matches suggests that your font 
> spec is underspecified, if your goal is to get just one specific font.
> I see no bug here.

Hi. The observed behavior (same face getting different fonts of varying
ugliness over time) cannot be considered correct, but I cannot yet say
where the bad behavior lies. It could be in Emacs or X or the Debian
font configuration.

Looking at this some more, I'm now more confused than when I started.
Any enlightenment is welcome.

To summarize the earlier findings:

- Emacs is asked for a font that matches the spec

 #<font-spec nil nil nil nil nil medium italic normal 11 nil nil nil nil>

- The font chosen by emacs can vary here. When it chooses the "ugly"
  path, it picks

 #<font-entity x adobe courier ## iso8859-1 medium i normal 0 0 0 0 nil>

- When X is asked for a corresponding font


it actually loads

 -urw-nimbus mono l-regular-o-normal--17-120-100-100-p-100-iso8859-1

Note that we originally sought an 11-px font, but got a 17-px one

OK. So the hypothesis is that the 11-px version of that 17-px urw font
does not exist, hence it's down-scaling the 17-px version. However,
apparently I can do

 xfontsel -pattern "-urw-nimbus mono 

and it works. I.e. xfontsel doesn't complain that the font doesn't
exist, it simply shows me the ugly 11-px font I'm complaining about.
I don't think this font actually exists (it's ugly; a human would not
draw it). However if I ask the font system whether it exists or not, it
unambiguously says yes:

 $ xlsfonts -fn "-urw-nimbus mono l-regular-o-normal--11-*-*-*-p-70-iso8859-1"

 -urw-nimbus mono l-regular-o-normal--11-79-100-100-p-70-iso8859-1

However, when I use a wildcard for the font size, (so * instead of 11),
it reports that the 11-px font does NOT exist, but a 17-px one does:

 $ xlsfonts -fn "-urw-nimbus mono l-regular-o-normal--*-*-*-*-p-70-iso8859-1"

 -urw-nimbus mono l-regular-o-normal--17-120-100-100-p-70-iso8859-1

This 17-px font looks good in xfontsel, but it's obviously bigger than
the 11-px one.

It looks like the font specs have a pixel-size and a point-size, (11-79)
and (17-120), with the ratio staying roughly constant in either case, so
the 11-79 is almost certainly a scaled version of 17-120. Problem is
that the rendering is based on the px-size only, so it looks like crap.
Is this how X fonts are supposed to work? What if Emacs treated scalable
fonts by looking at the actual px-sizes that were available (17 in this
case) and only evaluating those? Would that be a reasonable thing to do?
I can work on an implementation if it is.


reply via email to

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