From: Vincent Lefevre <vincent@vinc17.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 44284@debbugs.gnu.org
Subject: bug#44284: 27.1; with some Unicode font, scrolling upward with the mouse wheel actually scrolls downward when the cursor needs repositioning
Date: Sun, 1 Nov 2020 18:32:40 +0100 [thread overview]
Message-ID: <20201101173240.GO27593@zira.vinc17.org> (raw)
In-Reply-To: <83ft5tf3zr.fsf@gnu.org>
On 2020-11-01 18:15:04 +0200, Eli Zaretskii wrote:
> Interesting. Once you understand where did the value 12 come from,
> perhaps you could see how things are different in a non-Cairo build.
It appears that Cairo uses floating point with poor rounding control
(see below). I suppose that the non-cairo driver keeps integers.
> Let me describe how row->phys_ascent is computed, so that you could
> take a closer look.
[...]
Yes, this is what I've found:
The row->phys_ascent comes from function display_line, in the loop
generating characters:
if (/* Not a newline. */
nglyphs > 0
/* Glyphs produced fit entirely in the line. */
&& it->current_x < it->last_visible_x)
{
[...]
row->phys_ascent = max (row->phys_ascent, it->max_phys_ascent);
[...]
}
At the first iteration, row->phys_ascent is changed from 0 to 12.
So, it comes from it->max_phys_ascent, which is set to 12 by
PRODUCE_GLYPHS (it);
earlier in the loop. In this context (X protocol), this macro calls
gui_produce_glyphs (defined in xdisp.c).
In gui_produce_glyphs, this is case it->what == IT_CHARACTER, with
it->char_to_display == 'F'; pcm is true and it->phys_ascent is set
to 12 by
it->phys_ascent = pcm->ascent + boff;
where pcm->ascent = 12 and boff = 0, while for Emacs without cairo,
pcm->ascent = 11 (and boff = 0) as expected.
With size 14 (with or without cairo), one has pcm->ascent = 12.
Thus the issue comes from pcm->ascent. It is set by get_per_char_metric,
where char2b = 40. With cairo, it calls function ftcrfont_text_extents
(defined in ftcrfont.c), which calls ftcrfont_glyph_extents, which sets
metrics->ascent to 12 from the cache.
When the cache is filled with
cache->ascent = ceil (- extents.y_bearing);
extents.y_bearing (whose type is double) is equal to:
Font size 13: -0x1.6000000000001p+3 ≈ -11.000000000000002
Font size 14: -0x1.8p+3 = -12
With ceil(), 11.000000000000002 rounds to 12, while the expected value
is 11. A rounding issue, as I guessed at
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=44284#29
--
Vincent Lefèvre <vincent@vinc17.net> - 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)
next prev parent reply other threads:[~2020-11-01 17:32 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-28 16:36 bug#44284: 27.1; with some Unicode font, scrolling upward with the mouse wheel actually scrolls downward when the cursor needs repositioning Vincent Lefevre
2020-10-28 16:44 ` Vincent Lefevre
2020-10-28 16:53 ` Eli Zaretskii
2020-10-30 10:52 ` Vincent Lefevre
2020-10-30 11:31 ` Eli Zaretskii
2020-10-30 13:33 ` Vincent Lefevre
2020-10-30 13:37 ` Eli Zaretskii
2020-10-30 16:31 ` Vincent Lefevre
2020-10-30 20:34 ` Vincent Lefevre
2020-10-30 20:57 ` Vincent Lefevre
2020-10-30 21:09 ` Eli Zaretskii
2020-10-30 23:00 ` Vincent Lefevre
2020-10-31 0:46 ` Vincent Lefevre
2020-10-31 1:13 ` Vincent Lefevre
2020-10-31 7:38 ` Eli Zaretskii
2020-10-31 22:43 ` Vincent Lefevre
2020-11-01 0:24 ` Vincent Lefevre
2020-11-01 0:28 ` Vincent Lefevre
2020-11-01 16:15 ` Eli Zaretskii
2020-11-01 16:15 ` Eli Zaretskii
2020-11-01 17:32 ` Vincent Lefevre [this message]
2020-11-01 17:43 ` Eli Zaretskii
2020-11-01 18:34 ` Vincent Lefevre
2020-11-01 18:47 ` Eli Zaretskii
2020-11-01 21:13 ` Vincent Lefevre
2020-11-07 8:29 ` Eli Zaretskii
2020-11-07 10:35 ` Vincent Lefevre
2020-11-07 13:22 ` Eli Zaretskii
2020-11-01 15:55 ` Eli Zaretskii
2020-11-01 17:26 ` Vincent Lefevre
2020-10-30 20:58 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201101173240.GO27593@zira.vinc17.org \
--to=vincent@vinc17.net \
--cc=44284@debbugs.gnu.org \
--cc=eliz@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.