GNU bug report logs - #50660
28.0.50; Text artifacting when the cursor moves over text under mouse face that originally displayed a box

Previous Next

Package: emacs;

Reported by: Po Lu <luangruo <at> yahoo.com>

Date: Sat, 18 Sep 2021 12:24:01 UTC

Severity: normal

Found in version 28.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: Po Lu <luangruo <at> yahoo.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: larsi <at> gnus.org, 50660 <at> debbugs.gnu.org
Subject: bug#50660: 28.0.50; Text artifacting when the cursor moves over text under mouse face that originally displayed a box
Date: Sat, 16 Oct 2021 14:39:58 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

>> I meant what it should be after the processing, and by "the original
>> font", I meant the font of the original face, that was used to calculate
>> the metrics of the glyphs.

> FACE_FOR_CHAR will get you the face with the correct font, and calling
> get_glyph_face_and_encoding after that will produce the glyph codes
> from that font.  So that's exactly why I commented why your additional
> code must be before the loop that produces the glyph codes (inside
> get_glyph_face_and_encoding).

We might be misunderstanding something: I'm asking whether to arrange
fill_glyph_string like such:

  /* The loop with get_glyph_face_and_encoding is above this comment */
  s->font = s->face->font;
  if (s->hl == DRAW_MOUSE_FACE
      || (s->hl == DRAW_CURSOR && cursor_in_mouse_face_p (s->w)))
    {
      Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (s->f);
      struct face *face
        = FACE_FROM_ID (s->f, hlinfo->mouse_face_face_id);
      s->face
        = FACE_FROM_ID (s->f, FACE_FOR_CHAR (s->f, face,
					     s->first_glyph->u.ch, -1, Qnil));
    }

Or like such:

  /* get_glyph_face_and_encoding is modified to produce glyphs with the
     mouse face in the loop here. */
  while (glyph < last
	 && glyph->type == CHAR_GLYPH
	 && glyph->voffset == voffset
	 /* Same face id implies same font, nowadays.  */
	 && glyph->face_id == face_id
	 && glyph->glyph_not_available_p == glyph_not_available_p)
    {
      s->face = get_glyph_face_and_encoding (s->f, glyph,
					     s->char2b + s->nchars,
                                             /* This argument controls whether or not
                                                get_glyph_face_and_encoding uses the mouse face */
                                             (s->hl == DRAW_MOUSE_FACE
                                              || (s->hl == DRAW_CURSOR
                                                  && cursor_in_mouse_face_p (s->w)));
      ++s->nchars;
      eassert (s->nchars <= end - start);
      s->width += glyph->pixel_width;
      if (glyph++->padding_p != s->padding_p)
	break;
    }

  s->font = s->face->font;

I think the first situation will work better, because we want the mouse
face to be drawn with the font that the regular face is under, not the
font of the mouse face.  This is how the old code in *term.c used to
behave, and prevents the text from being drawn with a font (font, not
face) that has metrics different from that of the mouse face's font.




This bug report was last modified 3 years and 275 days ago.

Previous Next


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