GNU bug report logs - #20628
25.0.50; Incorrect line height for some fonts

Previous Next

Package: emacs;

Reported by: Clément Pit--Claudel <clement.pitclaudel <at> live.com>

Date: Fri, 22 May 2015 03:03:02 UTC

Severity: normal

Found in version 25.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: wl <at> gnu.org, clement.pitclaudel <at> live.com, ohwoeowho <at> gmail.com
Cc: 20628 <at> debbugs.gnu.org
Subject: bug#20628: 25.0.50; Incorrect line height for some fonts
Date: Sun, 24 May 2015 13:06:57 +0300
> Date: Sun, 24 May 2015 12:48:46 +0300
> From: Eli Zaretskii <eliz <at> gnu.org>
> Cc: clement.pitclaudel <at> live.com, ohwoeowho <at> gmail.com, 20628 <at> debbugs.gnu.org
> 
> > Have you seen my message w.r.t. the `ascent' and `descent' fields in
> > the `font_metrics' structure of Emacs?  Does this help?
> 
> Yes, I've seen it; and yes, it helps.  I need to try the solution
> based on that.

Actually, I need help with this, as I don't know enough about fonts,
and don't have access to systems where per-character ascent/descent
values are currently available in Emacs.

So I'm going to describe here the information that should allow those
who have access to affected systems to propose a patch.

The relevant place in the display engine where these factors are taken
into consideration is around line 26388 in xdisp.c, which is part of
the function x_produce_glyphs.  There you will find a call to the
function get_per_char_metric, which in turn calls the font driver's
text_extents method.  The metrics returned by get_per_char_metric
include ascent and descent, but I think they are not in pixel units.
We currently assign these values to the phys_ascent and phys_descent
of 'struct it', the iterator object used to walk the visible portion
of the buffer and produce glyphs for display.  I'm not sure what we do
with phys_ascent and phys_descent values once we compute them, but you
can search for them in xdisp.c to get the idea.  By contrast, the
height of the screen line is computed by summing it->ascent and
it->descent, which currently are set using the font's ascent and
descent values.

The change we look for should:

  . set the initial values for it->ascent and it->descent using some
    heuristics based on pixel_size of the default face's font;

  . update it->ascent and it->descent based on ascent/descent values
    returned by get_per_char_metric in the per-character metrics data

If people who want to work on this have questions about the display
engine, please don't hesitate to ask.

Thanks in advance!




This bug report was last modified 9 years and 356 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.