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

From: Eli Zaretskii <[email-masked]>
Date: Fri, 22 May 2015 18:05:21 +0300

> Date: Fri, 22 May 2015 17:49:16 +0300
> From: Eli Zaretskii <[email-masked]>
> Cc: [email-masked], [email-masked]
> 
> AFAIK, they are initialized from the font data.  Here's what ftfont.c
> does in ftfont_open:
> 
>   scalable = (INTEGERP (AREF (entity, FONT_AVGWIDTH_INDEX))
> 	      && XINT (AREF (entity, FONT_AVGWIDTH_INDEX)) == 0);
>   if (scalable)
>     {
>       font->ascent = ft_face->ascender * size / upEM;
>       font->descent = - ft_face->descender * size / upEM;
>       font->height = ft_face->height * size / upEM;
>     }
>   else
>     {
>       font->ascent = ft_face->size->metrics.ascender >> 6;
>       font->descent = - ft_face->size->metrics.descender >> 6;
>       font->height = ft_face->size->metrics.height >> 6;
>     }
> 
> And the fields of ft_face seem to be set by FreeType library, via the
> call to FT_Set_Pixel_Sizes, a few lines before the above snippet.

Forgot to tell that similar code you can find in xfont.c and
xftfont.c (and w32font.c for Windows).  Which of these is actually
used in your Emacs depends on how it was configured and against which
libraries it was linked.