Subject: bug#50660: 28.0.50; Text artifacting when the cursor moves over text under mouse face that originally displayed a box

From: Eli Zaretskii <[email-masked]>
Date: Sat, 16 Oct 2021 10:00:34 +0300

> From: Po Lu <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Sat, 16 Oct 2021 14:39:58 +0800
> 
> 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.

I don't understand: if the mouse-face changes the font, you want to
ignore that? why does that make sense?

And mouse-face is defined for ASCII font only anyway, which is why the
code calls FACE_FOR_CHAR.  You want to ignore the font that this call
produces?

> 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.

A face includes the font, so I don't understand why you want to
separate them, and how.

As for the old code: are you sure that's not a bug, part of the same
subtle issue you are trying to fix?

Btw, I'm not sure we need move the face selection into
get_glyph_face_and_encoding, I think it should be left outside.  That
selection needs to be done only once, whereas
get_glyph_face_and_encoding is called in a loop.  You just should move
the face determination before the loop, and momentarily change
glyph->face to the selected face and back around the call to
get_glyph_face_and_encoding.

Maybe I'm wrong (it won't be the first time), but in that case please
produce an example of a situation where my opinion produces incorrect
results, so I could study it and find what I am missing now.  Or maybe
you could describe in more detail what you discovered about the
artifacts I reported, which led you to these changes, because perhaps
I don't have a clear idea about what exactly are you trying to fix
here.