GNU bug report logs - #39504
27.0.60; [PATCH] eww/shr: Ensure faces of enclosing elements apply to <code> elements

Previous Next

Package: emacs;

Reported by: Kévin Le Gouguec <kevin.legouguec <at> gmail.com>

Date: Sat, 8 Feb 2020 00:07:01 UTC

Severity: normal

Tags: fixed, patch

Found in version 27.0.60

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Kévin Le Gouguec <kevin.legouguec <at> gmail.com>
To: 39504 <at> debbugs.gnu.org
Subject: bug#39504: 27.0.60; [PATCH] eww/shr: Ensure faces of enclosing elements apply to <code> elements
Date: Sat, 08 Feb 2020 01:06:11 +0100
[Message part 1 (text/plain, inline)]
Hello!

I have a minor gripe with the way eww/shr render <code> elements within
other inline elements.  My main frustration stems from code inside
links[1], but this extends to other elements, e.g. <strong> and <em>:

[foo.html (text/html, inline)]
[Message part 3 (text/plain, inline)]
Here is how Emacs 26.3 rendered it:

[emacs-26.png (image/png, attachment)]
[Message part 5 (text/plain, inline)]
Here is how Emacs 27 and 28 render it:

[emacs-27.png (image/png, attachment)]
[Message part 7 (text/plain, inline)]
Both Emacs variants fail to do what I'd expect:

- Emacs 26 uses variable-pitch for <code> elements,
- Emacs 27+ uses the default face, which does ensure a monospace font,
  but also neutralizes any effects of enclosing elements, e.g.
    - no bold inside <strong>,
    - no italics inside <em>,
    - no blue color nor underline inside <a>.

For example, here is how Firefox 72 does it:

[firefox-72.png (image/png, attachment)]
[Message part 9 (text/plain, inline)]
Here is a first, simple patch that uses fixed-pitch instead of default
to ensure other face attributes are not overridden:

[patch1.patch (text/x-diff, attachment)]
[Message part 11 (text/plain, inline)]
Here is an alternative patch which allows customizing the face used for
<code>, in case the user wants e.g. fixed-pitch-serif instead of
fixed-pitch:

[patch2.patch (text/x-diff, attachment)]
[Message part 13 (text/plain, inline)]
Both patches give the same results:

[patch.png (image/png, attachment)]
[Message part 15 (text/plain, inline)]
If the second patch seems like a worthwhile addition, I can augment it
with some documentation.


Thank you for your time.


[1] Cf. for example This Week In Rust:
    https://this-week-in-rust.org/blog/2020/02/04/this-week-in-rust-324/#updates-from-rust-core


In GNU Emacs 28.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0)
 of 2020-01-31 built on hirondell
Repository revision: d3ead375092e2690c1d1d6a5dd82e6e89cdf4f4c
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux 10 (buster)

Configured using:
 'configure --with-xwidgets --with-cairo'

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY
INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF
ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS
LIBSYSTEMD JSON PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

This bug report was last modified 5 years and 87 days ago.

Previous Next


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