Subject: Re: bug#3228: 23.0.93; GTK font selection: asked for Courier, got Nimbus

From: Kenichi Handa <[email-masked]>
Date: Mon, 18 May 2009 21:42:03 +0900

Sorry for the late response.

In article <[email-masked]>, Sven Joachim <[email-masked]> writes:

> On 2009-05-08 03:49 +0200, Kenichi Handa wrote:
> > In article <[email-masked]>, Sven Joachim <[email-masked]> writes:
> >
>>> Yes, /usr/share/fonts/X11/Type1/fonts.alias defines these aliases:
> >
>>> -adobe-courier-medium-r-normal--0-0-0-0-p-0-iso8859-1 "-urw-nimbus mono l-regular-r-normal--0-0-0-0-p-0-iso8859-1"
> >
> > Ok, I see.  It seems that the problem here is this:
> >
> > o menu-set-font returns the font name "courier 12"; i.e no
> > 	information about spacing, dpi
> > o no bitmap courier font has the exact pixelsize for 12pt on your screen.
> > o so Emacs selected a scalable font, that is the above "nimbus mono l" font.
> >
> > I think "% emacs -fn courier-12" will also select the
> > "nimbus mono l" font in this environment.

> Indeed.

> > Please try:
> > M-x set-default-font RET courier-12:spacing=m RET
> >
> > Doesn't it select a bitmap font, perhaps the same one as this
> > startup font?
> >
> >   xft:-Adobe-Courier-normal-normal-normal-*-17-*-*-*-m-100-iso10646-1

> That font is selected then, yes.

I've just installed a fix to handle :type property of font
correctly in set-face-attribute.

So, this problem can be solved by modifying x-select-font
(called from menu-set-font) to return a font-spec (with a
proper font-backend name in :type) instead of font-name.

But, x-select-font is called from mouse-appearance-menu (in
mouse.el) too, and it does something like this:

(buffer-face-mode-invoke (font-face-attributes (x-select-font)) ...)

and thus the :type information is lost by
font-face-attributes.  I don't know why we need
font-face-attributes here.

By the way, if a user is using `x' font-backend only, we
should not use x-select-font (of xfns.c) because the
selected font is usually not usable.

---
Kenichi Handa
[email-masked]