bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Eli Zaretskii
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 <address@hidden>
> Cc: address@hidden, address@hidden, address@hidden
> 
> > 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!





reply via email to

[Prev in Thread] Current Thread [Next in Thread]