Subject: Re: bug#6526: 24.0.50; Font X resouce is ignored

From: Jan Djärv <[email-masked]>
Date: Wed, 30 Jun 2010 11:30:30 +0200

Kenichi Handa skrev 2010-06-30 09.41:
> In article<[email-masked]>, Jan Djärv<[email-masked]>  writes:
>
>> Application font is not what we use, it is Monospaced font.  Other things to
>> check for:
>
> Ah! Perhaps you actually mean "Fixed width font".  When I
> change it from "monospace" to "freemono", Emacs surely uses
> "freemono" font.

Yes, I meant Fixed width.  I didn't have the actual screen in front of me.

>> and customize font-use-system-font to t?
>
> No.  The docstring says "*Non-nil means to use the system
> defined font.", but doesn't say what "nil" means.  Anyway,
> if there's no Font X resource, it seems that Emacs uses the
> system defined font even if font-use-system-font is nil.

I'll improve the documentation.

>
> Previously, if there's no Font X resource, Emacs tried to
> use one of these predefined fonts (extracted from
> x_default_font_parameter):
>
>        char *names[]
> 	= {
> #ifdef HAVE_XFT
> 	    /* This will find the normal Xft font.  */
>   	    "monospace-10",
> #endif
> 	    "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1",
> 	    "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1",
> 	    "-*-*-medium-r-normal-*-*-140-*-*-c-*-iso8859-1",
> 	    /* This was formerly the first thing tried, but it finds
> 	       too many fonts and takes too long.  */
> 	    "-*-*-medium-r-*-*-*-*-*-*-c-*-iso8859-1",
> 	    /* If those didn't work, look for something which will
> 	       at least work.  */
> 	    "-*-fixed-*-*-*-*-*-140-*-*-c-*-iso8859-1",
> 	    "fixed",
> 	    NULL };
>
> So, the current behaviour is still different from the
> previous one.  Though I'm not claiming that the current
> behaviour is worse.
>

It is the same old startup problem.  For the first frame we don't know if 
font-use-system-font is set as .emacs has not been read when the code above is 
run.  So we suggest the system font anyway, it is as good a suggestion as any 
other font.  Better in fact, we can be sure that font exists and is probably 
familiar to the user if gedit or gnome-terminal has been used.

>> You can check for feature system-font-setting in Emacs, it is set if GConf is
>> compiled in.
>
> (featurep 'system-font-setting) =>  t
>
>> The function font-get-system-font should return the system
>> monospaced font.  You can get application font by calling
>> font-get-system-normal-font.
>
> Both return nil.
>
> When I customize font-use-system-font to t, they return
> correct font names.  It's a little bit strange behavior.  I
> think they should return font names even if
> font-use-system-font is non-nil.
>

It was needed at some point, but I think that is not the case anymore.  I'll 
check.  font-use-system-font controls if Emacs changes its fonts on the fly 
when the system font is changed.

	Jan D.