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

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

bug#50660: 28.0.50; Text artifacting when the cursor moves over text und


From: Po Lu
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Eli Zaretskii <eliz@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.




reply via email to

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