unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#26958: Can we make wavy underlines scale like straight ones?
@ 2017-05-17  3:47 Clément Pit--Claudel
  2017-05-17  4:14 ` Drew Adams
  2017-05-17 15:23 ` Eli Zaretskii
  0 siblings, 2 replies; 6+ messages in thread
From: Clément Pit--Claudel @ 2017-05-17  3:47 UTC (permalink / raw)
  To: 26958


[-- Attachment #1.1: Type: text/plain, Size: 793 bytes --]

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.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#26958: Can we make wavy underlines scale like straight ones?
  2017-05-17  3:47 bug#26958: Can we make wavy underlines scale like straight ones? Clément Pit--Claudel
@ 2017-05-17  4:14 ` Drew Adams
  2017-05-17  4:36   ` Clément Pit--Claudel
  2017-05-17 15:23 ` Eli Zaretskii
  1 sibling, 1 reply; 6+ messages in thread
From: Drew Adams @ 2017-05-17  4:14 UTC (permalink / raw)
  To: Clément Pit--Claudel, 26958

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





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#26958: Can we make wavy underlines scale like straight ones?
  2017-05-17  4:14 ` Drew Adams
@ 2017-05-17  4:36   ` Clément Pit--Claudel
  0 siblings, 0 replies; 6+ messages in thread
From: Clément Pit--Claudel @ 2017-05-17  4:36 UTC (permalink / raw)
  To: Drew Adams, 26958


[-- Attachment #1.1: Type: text/plain, Size: 2967 bytes --]

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.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#26958: Can we make wavy underlines scale like straight ones?
  2017-05-17  3:47 bug#26958: Can we make wavy underlines scale like straight ones? Clément Pit--Claudel
  2017-05-17  4:14 ` Drew Adams
@ 2017-05-17 15:23 ` Eli Zaretskii
  2017-05-17 19:38   ` Clément Pit--Claudel
  1 sibling, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2017-05-17 15:23 UTC (permalink / raw)
  To: Clément Pit--Claudel; +Cc: 26958

> From: Clément Pit--Claudel <clement.pitclaudel@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.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#26958: Can we make wavy underlines scale like straight ones?
  2017-05-17 15:23 ` Eli Zaretskii
@ 2017-05-17 19:38   ` Clément Pit--Claudel
  2017-05-19  7:18     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Clément Pit--Claudel @ 2017-05-17 19:38 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 26958


[-- Attachment #1.1: Type: text/plain, Size: 379 bytes --]

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.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#26958: Can we make wavy underlines scale like straight ones?
  2017-05-17 19:38   ` Clément Pit--Claudel
@ 2017-05-19  7:18     ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2017-05-19  7:18 UTC (permalink / raw)
  To: Clément Pit--Claudel; +Cc: 26958

> Cc: 26958@debbugs.gnu.org
> From: Clément Pit--Claudel <clement.pitclaudel@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?





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-05-19  7:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-17  3:47 bug#26958: Can we make wavy underlines scale like straight ones? Clément Pit--Claudel
2017-05-17  4:14 ` Drew Adams
2017-05-17  4:36   ` Clément Pit--Claudel
2017-05-17 15:23 ` Eli Zaretskii
2017-05-17 19:38   ` Clément Pit--Claudel
2017-05-19  7:18     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).