Subject: bug#20510: 25.0.50; Underscore hidden by underline

From: Eli Zaretskii <[email-masked]>
Date: Mon, 30 Sep 2019 09:39:45 +0300

> From: Stefan Kangas <[email-masked]>
> Date: Mon, 30 Sep 2019 02:10:24 +0200
> Cc: Fabrice Niessen <[email-masked]>, [email-masked]
> 
> >> I mean: can't the hl-line-mode code be written in a way that the
> >> underline goes in the background of the character, that is that every
> >> pixel of every character gets written "over" the underline line?
> >
> > hl-line-mode cannot control that, and nothing on the Lisp level can.
> >
> > When hl-line-mode puts its overlay on a line, the characters of that
> > line have the hl-line face merged with their face, with the result
> > that each character of that line will have the underline face in the
> > color you specify.  That's all Lisp can do; then along comes the
> > display engine and redraws the characters in this new merged face.
> > The C code which draws characters is written so that we first draw the
> > background, then the characters, then the underline.
> >
> > So what you are actually asking is that the order of drawing the
> > underline (and also overline, strike-through, etc.) is changed so that
> > these attributes are drawn _before_ the characters.  That should be
> > possible by changing the order in the C code, but I have no idea what
> > that will do in other situations.  It's probably not TRT at least when
> > we draw images and other similar stuff instead of characters.
> >
> > Perhaps someone who knows more than I do about GUI display back-end
> > could tell if this is a safe change.
> 
> It sounds to me like this is not something we are interested in doing.
> I'm closing this as wontfix.

I can also suggest trying to play with the following variables, which
affect how the underline is displayed:

  underline-minimum-offset
  x-underline-at-descent-line
  x-use-underline-position-properties