Subject: Re: bug#29078: 25.2; font issue with FreeType 2.8; should not use the rounded ascender and descender

From: Vincent Lefevre <[email-masked]>
Date: Mon, 18 Nov 2019 19:15:27 +0100

On 2019-11-18 19:50:09 +0200, Eli Zaretskii wrote:
> > Date: Mon, 18 Nov 2019 18:23:33 +0100
> > From: Vincent Lefevre <[email-masked]>
> > Cc: [email-masked], [email-masked]
> > 
> > AFAIK, from the font description (which does not involve rounding),
> > there is no gap (that's why the FreeType developers suggested not
> > to use the rounded values). Moreover, it does not make much sense
> > to insert a gap. This looks ugly and this wastes screen space.
> 
> Emacs doesn't insert any gaps, it just computes the line metrics from
> all the characters displayed on that line.

There are different ways to do the computation, and due to the rounded
values, they give different results. Compared to the cell height,
there is a gap. When I analyzed the issue with xterm, I could find
that with the rounded metrics, height < ascent + descent (while this
is an equality with the unrounded metrics).

> I've read the discussions of the FreeType developers, but couldn't
> understand what they were talking about, as the discussion was in
> terms of internals of FreeType, and I don't know enough to map that to
> what the Emacs display engine does.
> 
> My point is that this seems to have nothing to do with the FreeType
> library or its version,

The issue appeared just after upgrading FreeType from 2.6 to 2.8,
and the FreeType developers said this was because they changed the
rounding rules for ttf fonts.

> since I see the same on a system that uses neither FreeType nor this
> particular font. IOW, this looks to me "normal", i.e. Emacs always
> worked like that.

Of course, if you change the font, you may see something different.

I've attached what I get with the fixed bitmap font. As you can see,
there is no gap, and this is the expected rendering (with bitmap fonts,
there are no rounding issues, thus what is shown is as designed).

-- 
Vincent Lefèvre <[email-masked]> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)