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

From: Eli Zaretskii <[email-masked]>
Date: Fri, 29 May 2015 16:15:22 +0300

> 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"?

> > * 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.

> Additionally, these chars are bad: \\|, λ.

What do you mean by "bad"?  Here, they just make the line slightly
higher (by a few pixels), again due to the metrics of the glyphs, but
nowhere near the original height before my changes.  Isn't that what
you see?

> And all lines in Buffer-menu-mode are super-tall, just like the mode
> line.

That's because Buffer-menu-mode uses 'space' display property, which
is another place where we use font dimensions.  I will see if that can
be fixed.