GNU bug report logs - #26958
Can we make wavy underlines scale like straight ones?

Previous Next

Package: emacs;

Reported by: Clément Pit--Claudel <clement.pitclaudel <at> live.com>

Date: Wed, 17 May 2017 03:49:02 UTC

Severity: wishlist

To reply to this bug, email your comments to 26958 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#26958; Package emacs. (Wed, 17 May 2017 03:49:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Clément Pit--Claudel <clement.pitclaudel <at> live.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 17 May 2017 03:49:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Can we make wavy underlines scale like straight ones?
Date: Tue, 16 May 2017 23:47:48 -0400
[Message part 1 (text/plain, inline)]
Hi bug-gnu-emacs,

Straight underlines get thicker when font size increases, but wavy underlines do not.  The problem is particularly visible on hi-resolution displays, where wavy underlines look really tiny. This problem can be observed on all displays by running the following and pressing C-x C-= a few times:

(font-lock-mode -1)
(insert (propertize "AAAAA" 'face '(:underline (:style line)))
        "\n" (propertize "AAAAA" 'face '(:underline (:style wave))))

I've seen the problem mentioned a few times online (https://emacs.stackexchange.com/questions/24713/change-size-of-wavy-underlines-for-hidpi-displays, https://www.reddit.com/r/emacs/comments/51wm7d/emacs_on_hidpi_displays/).

For xterm.c, the relevant function seems to be x_draw_underwave.

Thanks!
Clément.

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26958; Package emacs. (Wed, 17 May 2017 04:15:02 GMT) Full text and rfc822 format available.

Message #8 received at 26958 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Clément Pit--Claudel <clement.pitclaudel <at> live.com>,
 26958 <at> debbugs.gnu.org
Subject: RE: bug#26958: Can we make wavy underlines scale like straight ones?
Date: Tue, 16 May 2017 21:14:24 -0700 (PDT)
> Straight underlines get thicker when font size increases, but wavy
> underlines do not.  The problem is particularly visible on hi-resolution
> displays, where wavy underlines look really tiny. This problem can be
> observed on all displays by running the following and pressing C-x C-= a few
> times:
> 
> (font-lock-mode -1)
> (insert (propertize "AAAAA" 'face '(:underline (:style line)))
>         "\n" (propertize "AAAAA" 'face '(:underline (:style wave))))

FWIW, on Windows I see neither straight nor wavy underline thicken.
They both continue to have the same line width (thickness) when
text-scaled.

Should they not stay the same?  Should they thicken?  Why?

I'm not on a "highdpi", I imagine.  But why should that make
difference as to whether an underline should change thickness
as the text is scaled?

What about :overline?  It has no :wavy property, but should
it too thicken when the text is scaled up?

And :box?  :box has a :line-width property.  Is that relevant
here?  What should the behavior be for :box?  What should it
be for attributes such as :underline or :overline or
:strike-through, which don't have a :line-width property?

It doesn't seem as if the right design is obvious.

Note that the first URL you cite does not ask necessarily for
the wavy underline to scale.  It explicitly asks about
customizing to specify the line width.

Maybe that's what the enhancement request should be: provide
:line-width for :underline, like we do for :box.  And perhaps
for :overline and :strike-through?

The first question is whether such line widths should respond
to scaling.  Dunno.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26958; Package emacs. (Wed, 17 May 2017 04:38:02 GMT) Full text and rfc822 format available.

Message #11 received at 26958 <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
To: Drew Adams <drew.adams <at> oracle.com>, 26958 <at> debbugs.gnu.org
Subject: Re: bug#26958: Can we make wavy underlines scale like straight ones?
Date: Wed, 17 May 2017 00:36:47 -0400
[Message part 1 (text/plain, inline)]
On 2017-05-17 00:14, Drew Adams wrote:
>> Straight underlines get thicker when font size increases, but wavy
>> underlines do not.  The problem is particularly visible on hi-resolution
>> displays, where wavy underlines look really tiny. This problem can be
>> observed on all displays by running the following and pressing C-x C-= a few
>> times:
>>
>> (font-lock-mode -1)
>> (insert (propertize "AAAAA" 'face '(:underline (:style line)))
>>         "\n" (propertize "AAAAA" 'face '(:underline (:style wave))))
> 
> FWIW, on Windows I see neither straight nor wavy underline thicken.
> They both continue to have the same line width (thickness) when
> text-scaled.
> 
> Should they not stay the same?  Should they thicken?  Why?

Thanks for the reply! They do scale in GNU/Linux; the code in xftfont says:

      font->underline_position = -ft_face->underline_position * size / upEM;
      font->underline_thickness = ft_face->underline_thickness * size / upEM;

The corresponding code in w32font says:

      font->underline_thickness = metrics->otmsUnderscoreSize;
      font->underline_position = -metrics->otmsUnderscorePosition;

which might be missing the scaling?

> I'm not on a "highdpi", I imagine.  But why should that make
> difference as to whether an underline should change thickness
> as the text is scaled?

That's the behavior I see on every other program that (I checked and that) supports underlines on my machine: Thunderbird (which also scales wavy underlines used to indicate spelling errors), Firefox, Chromium, and Libre Office Writer (which used to not scale spell-checking underlines, though this is partly fixed — see bug 90793).

> What about :overline?  It has no :wavy property, but should
> it too thicken when the text is scaled up?
> 
> And :box?  :box has a :line-width property.  Is that relevant
> here?  What should the behavior be for :box?  What should it
> be for attributes such as :underline or :overline or
> :strike-through, which don't have a :line-width property?
> 
> It doesn't seem as if the right design is obvious.

Judging by what web browsers do, they should all scale.

> Note that the first URL you cite does not ask necessarily for
> the wavy underline to scale.  It explicitly asks about
> customizing to specify the line width.
> 
> Maybe that's what the enhancement request should be: provide
> :line-width for :underline, like we do for :box.  And perhaps
> for :overline and :strike-through?

I made a separate request for (a limited version of) this.

> The first question is whether such line widths should respond
> to scaling.  Dunno.

I expect they should, based on looking at web browsers (and plenty of other programs — including Emacs ^^ ­— in the case of underlines).  But it's not only a thickness issue: it's also a positioning issue (the relative space between the text and the underline should be constant).

Clément.

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26958; Package emacs. (Wed, 17 May 2017 15:24:02 GMT) Full text and rfc822 format available.

Message #14 received at 26958 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
Cc: 26958 <at> debbugs.gnu.org
Subject: Re: bug#26958: Can we make wavy underlines scale like straight ones?
Date: Wed, 17 May 2017 18:23:16 +0300
> From: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
> Date: Tue, 16 May 2017 23:47:48 -0400
> 
> Straight underlines get thicker when font size increases

That's not really accurate, see my other messages.

> but wavy underlines do not.  The problem is particularly visible on hi-resolution displays, where wavy underlines look really tiny. This problem can be observed on all displays by running the following and pressing C-x C-= a few times:
> 
> (font-lock-mode -1)
> (insert (propertize "AAAAA" 'face '(:underline (:style line)))
>         "\n" (propertize "AAAAA" 'face '(:underline (:style wave))))
> 
> I've seen the problem mentioned a few times online (https://emacs.stackexchange.com/questions/24713/change-size-of-wavy-underlines-for-hidpi-displays, https://www.reddit.com/r/emacs/comments/51wm7d/emacs_on_hidpi_displays/).
> 
> For xterm.c, the relevant function seems to be x_draw_underwave.

How about sending a patch?

But I suggest to read about the related complications first, because I
think this issue is not as simple as it sounds.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26958; Package emacs. (Wed, 17 May 2017 19:40:02 GMT) Full text and rfc822 format available.

Message #17 received at 26958 <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 26958 <at> debbugs.gnu.org
Subject: Re: bug#26958: Can we make wavy underlines scale like straight ones?
Date: Wed, 17 May 2017 15:38:32 -0400
[Message part 1 (text/plain, inline)]
On 2017-05-17 11:23, Eli Zaretskii wrote:
>> For xterm.c, the relevant function seems to be x_draw_underwave.
> How about sending a patch?

I had a quick look. The current code uses a loop and draws line segments between each of the underline points.
This strategy doesn't look as pretty when using a thicker line.  Would it be OK to use XDrawLines instead?

Clément.

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26958; Package emacs. (Fri, 19 May 2017 07:19:02 GMT) Full text and rfc822 format available.

Message #20 received at 26958 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
Cc: 26958 <at> debbugs.gnu.org
Subject: Re: bug#26958: Can we make wavy underlines scale like straight ones?
Date: Fri, 19 May 2017 10:18:30 +0300
> Cc: 26958 <at> debbugs.gnu.org
> From: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
> Date: Wed, 17 May 2017 15:38:32 -0400
> 
> On 2017-05-17 11:23, Eli Zaretskii wrote:
> >> For xterm.c, the relevant function seems to be x_draw_underwave.
> > How about sending a patch?
> 
> I had a quick look. The current code uses a loop and draws line segments between each of the underline points.
> This strategy doesn't look as pretty when using a thicker line.  Would it be OK to use XDrawLines instead?

I don't think I understand your proposal, and I'm not an expert on X
graphics anyway.  How about presenting a patch that works for you?




This bug report was last modified 8 years and 28 days ago.

Previous Next


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