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

From: Oleh Krehel <[email-masked]>
Date: Fri, 22 May 2015 18:33:43 +0200

Eli Zaretskii <[email-masked]> writes:

>> From: Oleh Krehel <[email-masked]>
>> Cc: [email-masked],  [email-masked]
>> Date: Fri, 22 May 2015 18:15:28 +0200
>> 
>> >> So far I've tracked the bug to xftfont_open, where instead of the
>> >> usual
>> >> 
>> >>     font ascent: 14, descent: 5
>> >> 
>> >> I get for the 120755 char:
>> >> 
>> >>     font ascent: 54, descent: 46
>
> According to what I see here 120755 (#x1d7b3) is the same kappa symbol
> as #x1d779, just in italic form.  Not sure why Emacs on your system
> displays the former when you request the latter, but at least it's the
> same letter.  Perhaps the font driver substitutes one for the other?

Could be. I don't mind that really, just the ascent/descent.

>> > How is this strange character displayed, eventually?  Is it displayed
>> > as a character or as a box with its hex code?
>> 
>> It's displayed just the way gedit displays it, only with a huge (3 line
>> height) ascent and a huge (3 line height) descent. So the line with the
>> char is effectively 7 times taller than a regular line.
>> 
>> Also, I've tracked the font family of the char to be "Latin Modern
>> Mathfont" in xftfont_open.
>
> Math fonts are notorious for requesting huge ascent and descent
> values.  I always disable them using fontsets.

Can you explain what are fontsets and how to use the to disable
ascent/descent in math? Is it possible for Emacs to do so by default?

In any case, here's more data for the bad font that gets created with
XftFontOpenPattern.

Family:
    $ p (FcChar8 *) SDATA (SYMBOL_NAME (val))
    "Latin Modern Math"

Foundry:
    $ p (FcChar8 *) SDATA (SYMBOL_NAME (val))
    "unknown"

Filename:

    $ p (FcChar8 *) SDATA (filename)
    "/usr/share/texmf/fonts/opentype/public/lm-math/latinmodernmath-regular.otf"

So it might be that I could just patch latinmodernmath-regular.otf to
fix the problem. Or maybe Emacs could fix the problem specifically for
this file / font family. That's what gedit does, I guess.