Subject: Re: bug#25216: 26.0.50 [regression]; Curly quotes are not found in some sizes of ‘Terminus’ font

From: Eli Zaretskii <[email-masked]>
Date: Sat, 17 Dec 2016 13:02:42 +0200

> From: Dmitry Alexandrov <[email-masked]>
> Cc: [email-masked]
> Date: Sat, 17 Dec 2016 12:33:01 +0300
> 
> > What is wrong with how it looks?
> 
> That’s apparently another font.
> 
> > Info mode uses several fonts anyway,
> 
> ‘GNU Emacs Manual’ was a mere example of an easy accessible page that uses that symbols.  And the quotes are not the only problematic glyphs, just the most notable ones.  Now I noticed the same issue with arrows: ↑ ← ↓ and →, I guess there are others.

It doesn't surprise me.  What I don't understand is why this happens.
Emacs explicitly tests the default font for supporting any symbol or
punctuation character it needs to display, before it looks for another
font.  See the function face_for_char in fontset.c.

> Aha!  Thanks.  The exact problematic commit is ‘2276a19d’ [0].
> 
> By the way, how could I prove that without rebuilding the whole Emacs?  I tried:
> 
>    $ git show 2276a19^:lisp/international/fontset.el > /tmp/lisp/fontset.el
>    $ emacs --directory /tmp/lisp --quick --font '-*-terminus-medium-r-*-*-20-*-*-*-*-*-*-*'
> 
> Despite that:
> 
>    (locate-library "fontset")
>         ⇒ "/tmp/lisp/fontset.el"
> 
> I did not see any effect.

You must rebuild Emacs or manually load fontset.el after changing it.
fontset.el is preloaded when Emacs is built.

> > I think you should be able to force Emacs to use your font for these
> > characters by using set-fontset-font for the range of codepoints you
> > want to be displayed by the Terminus font.
> 
> Yes, indeed.  Many thanks.
> 
>    (set-fontset-font "fontset-default" '(#x2000 . #x2067) "Terminus")
> 
> However, It might be even better if I could erase that rule, as if there were no lines about that range in ‘fontsel.el’.  Is it possible?

That would adversely affect all the users.  We arrived at that rule
after many complaints that symbol and punctuation characters are not
displayed at all, or displayed using variable-pitch fonts, so we made
the default fontset "smarter" about that by using fonts people
generally have installed and which are the default fonts in Emacs.

> > Of course, if you or someone can explain why Emacs doesn't use the
> > default font, as it should have, for these characters, that would be
> > even better, since we might then be able to fix the problem without
> > any need for user customizations.
> >
> > One idea I have is that the way you specify the font on the Emacs
> > command line doesn't specify a registry.  Did you try using iso10646-1
> > as the registry?
> 
> I’ve just tried — no effect.

You don't need to change fontset.el for that, just add the
set-fontset-font line to your .emacs.