Subject: Re: bug#67269: 30.0.50; italic face fallback does not assume italic properties

From: Eli Zaretskii <[email-masked]>
Date: Mon, 20 Nov 2023 13:55:10 +0200

> From: Po Lu <[email-masked]>
> Cc: [email-masked]
> Date: Mon, 20 Nov 2023 08:22:35 +0800
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> > Then maybe we should change the default fontset's definition on
> > Android (if those are the systems you have in mind).  We already do
> > that for w32, see w32-standard-fontset-spec as opposed to
> > standard-fontset-spec.
> 
> The systems I have in mind aren't only Android: Noto Sand Mono is the
> default (or only) Monospace font on many GNU/Linux systems as well, and
> I've also witnessed DejaVu Sans Mono being installed without an Italic
> variant.

If so, then it is strange that we haven't heard about this issue
before.

Maybe we should do something like the below, and leave the rest to end
users and downstream distros.

> > I don't understand how shr-tag-i is relevant.  I'm probably missing
> > something.
> 
> It combines a variable pitch face with italic, and so loses when the
> italic face doesn't support slant properties, even if the variable pitch
> one does.

Yes, you already said that in your original message.  I thought
shr-tag-i provides some additional insight.

diff --git a/lisp/faces.el b/lisp/faces.el
index 7eacc40..8eaabbf 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -2440,7 +2440,10 @@ italic
   '((((supports :slant italic))
      :slant italic)
     (((supports :underline t))
-     :underline t)
+     ;; Include italic, even if it isn't supported by the default
+     ;; font, because this face could be merged with another face
+     ;; which uses font that does have an italic variant.
+     :underline t :slant italic)
     (t
      ;; Default to italic, even if it doesn't appear to be supported,
      ;; because in some cases the display engine will do its own
@@ -2457,7 +2460,9 @@ bold-italic
 (defface underline
   '((((supports :underline t))
      :underline t)
-    (((supports :weight bold))
+    ;; Include underline, for when this face is merged with another
+    ;; whose font does support underline.
+    (((supports :weight bold :underline t))
      :weight bold)
     (t :underline t))
   "Basic underlined face."