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

From: Clément Pit--Claudel<[email-masked]>
Date: Fri, 29 May 2015 22:21:29 -0700

On 05/29/2015 06:15 AM, Eli Zaretskii wrote:
>> From: Oleh Krehel <[email-masked]>
>> Cc: Eli Zaretskii <[email-masked]>,  [email-masked],  [email-masked]
>> Date: Fri, 29 May 2015 11:30:55 +0200
>>
>> Clément Pit--Claudel <[email-masked]> writes:
>>
>>> The patch partially solves the problem for me, but I noticed a few
>>> problems after running (set-frame-font "Latin Modern Math")
>>> * When the cursor is at the end of the file, on an empty line, it has a very height.
>                                                                             ^^^^^^^^^^^
> 
> "Very WHAT height"? "very small" or "very large"?

Woops, sorry. Very large height.

>>> * The fix seems to only apply to certain characters. The line that I
>>> mentioned in my original email, in particular, is still very tall. In
>>> other words, when trying the following three lines in a Latin Modern
>>> Math buffer, the last line is much too tall:
>>>
>>> 𝓝  ;; This is still very tall
> 
> I don't see this on my system.  Here, it makes the line slightly
> higher, and that's all. Perhaps you have a different version of the
> font installed.  But in any case, if that character still shows up as
> too large (a screenshot would be nice), and Emacs uses the Latin
> Modern Math font to display it (make sure with "C-u C-x ="), then
> there's nothing that can be done about that, since it means the
> metrics of the glyph itself, as reported by the font/font driver, are
> screwed.  If you want to make sure that's the reason, put a breakpoint
> on line 26425 of xdisp.c, after the call to get_per_char_metric, as
> shown below:
> 
> 	  if (get_char_glyph_code (it->char_to_display, font, &char2b))
> 	    {
> 	      pcm = get_per_char_metric (font, &char2b);
> 	      if (pcm->width == 0    <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> 		  && pcm->rbearing == 0 && pcm->lbearing == 0)
> 		pcm = NULL;
> 	    }
> 
> and see what ascent and descent values are reported for that character
> in pcm->ascent and pcm->descent.

Thanks for the detailed explanation! You were right, the height is fine if the character itself is inserted. The problem is due to prettify-symbols-mode.

Thanks for your work on this, it's very cool! This is a bug that had annoyed me 4 or 5 years ago when I first used Emacs, but at that time I didn't really know how to report bugs.