Subject: bug#20628: 25.0.50; Incorrect line height for some fonts

From: Eli Zaretskii <[email-masked]>
Date: Sat, 23 May 2015 10:20:45 +0300

> From: Stefan Monnier <[email-masked]>
> Cc: Eli Zaretskii <[email-masked]>,  [email-masked],  [email-masked]
> Date: Fri, 22 May 2015 18:43:56 -0400
> 
> > The reason gedit was working fine previously is that it never used
> > "Latin Modern Math", it used some other font.
> 
> IOW Emacs doesn't seem to behave differently from other applications
> w.r.t this font, except for the fact that it ends up selecting up while
> other apps select another font instead.
> 
> So the question becomes: why does Emacs select this font and how could
> we change ti so it selects something else.

Emacs selects that font because it's available, and claims support for
the particular character Emacs needs to display.

The only mechanism we currently have for tailoring the fonts used for
specific ranges of characters is by defining the standard fontsets.
The ones we provide out of the box are set up on fontset.el, which
see.

> BTW, I think that using something like
> 
>     (set-fontset-font fontset 'unicode (font-spec :name "Symbola") nil 'append)
> or
>     (set-fontset-font "fontset-default" '(#x1d400 . #x1d7ff) "Symbola")
> 
> just sucks: we don't want to say "use Symbola", but we instead want to
> say something like "avoid Latin Modern Math" or "ignore Latin Modern
> Math's ascent/descent information".

We don't have such a feature, AFAIK.  At least not a documented one.

And I don't agree with the "just sucks" part: there are use cases when
the user might prefer a specific font for valid reason, e.g. the
quality of the glyphs.  If there are more than a few fonts on the
system that support the same range of characters, it is easier to
prefer one than to un-prefer the rest.

Also, there are fonts that claim support for a specific block, but in
fact support that block only partially, in some extreme cases just a
few characters.  Emacs's naive (due to efficiency considerations) way
of looking up suitable fonts might yield a negative result, where a
font is chosen that claims support, and then turns out not to have a
glyph for the specific character we need to display.  In this
situation, making a fontset that names a font with good coverage for
some block is the way to go.