Subject: bug#79083: closed (Re: bug#79083: 31.0.50; Inconsistencies wrt fixed-pitch face)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 25 Jul 2025 08:04:02 +0000

Your bug report

#79083: 31.0.50; Inconsistencies wrt fixed-pitch face

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
79083: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=79083
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#79083: 31.0.50; Inconsistencies wrt fixed-pitch face
From: Sean Whitton <[email-masked]>
To: Eli Zaretskii <[email-masked]>
Cc: [email-masked], [email-masked], [email-masked], [email-masked]
Date: Fri, 25 Jul 2025 09:03:00 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello,

On Thu 24 Jul 2025 at 11:08am +03, Eli Zaretskii wrote:

> Well, now you know.  I realize that not every aspect of the Emacs
> design has its intent necessarily evident to everyone, but that
> doesn't yet mean we should make changes based on the fact that it
> takes time to understand the underlying ideas and their rationale.

Certainly.

>>   - on GNU/Linux chances are none of them are installed (I didn't even
>>     have Courier on my machine until just now) and so you'll get
>>     'fixed', which presumably is resolved concretely to the very same
>>     font family that "monospace-10" is resolved to.  Hence not visually
>>     distinct.
>
> No, on GNU/Linux we request "Monospace" from Fontconfig, and use what
> it gives us.
>
>> So I think the fix for the bug is to add some font families to
>> (assoc "Monospace" face-font-family-alternatives) which are both:
>> 1. very commonly present on GNU/Linux installations; and yet
>> 2. not what "monospace-10" will typically resolve to on those
>>    installations.
>
> This will probably not fix the issue, because (as the comment there
> says) face-font-family-alternatives is only used on systems without
> Fontconfig, which basically means we ignore it on GNU/Linux.  We'd
> need to make changes in Fontconfig files, something that I think is
> not acceptable.

Ah, I see, so another way to look at the issue is that we can't have two
different Monospace fonts without giving up on having Fontconfig handle
font selection for us.  And being able to rely on Fontconfig has all
sorts of benefits which are much more important than this.

>> I don't know what font families would fit the bill, and I agree that it
>> should be considered carefully and thoroughly.
>
> What you see in the current code _is_ the product of carefully
> considering these issues, and also of many years of experience using
> the results.  Personally, I wouldn't touch that with a 10-mile pole.
>
> Again, would you please state some real-life problems we are trying to
> fix here?

Many parts of Emacs are very carefully considered, and other parts
aren't, but look like they are until you investigate a bit.  I was
following my instincts to understand this part better and to write it
down.  Thank you for helping me understand the situation.
I'll now close the bug.

-- 
Sean Whitton

Subject: 31.0.50; Inconsistencies wrt fixed-pitch face
From: Sean Whitton <[email-masked]>
To: [email-masked]
Date: Wed, 23 Jul 2025 15:27:14 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

X-debbugs-cc: [email-masked], [email-masked], [email-masked], [email-masked]

Hello,

There are a couple of related issues I would like to resolve with the
fixed-pitch face.

(1)
I had assumed that the purpose of this face was solely to be fixed pitch
even when the default face uses a variable pitch font.  A Lisp program
could use this face when something really must display as fixed pitch.

But in [1] Eli writes:
> Did you expect the fixed-pitch face to have the same font as the
> default face?  If so, it's a wrong expectation: we deliberately
> defined the fixed-pitch face to have a different typeface, so that it
> stands out.

This is not incompatible with being a face that's always fixed pitch no
matter whether the default face is fixed pitch, but it does mean that
themes, or the user, shouldn't usually customise default and fixed-pitch
to use the same typeface.  If this is the idea, then it should be
documented, and I would propose to do so as follows:

--8<---------------cut here---------------start------------->8---
diff --git a/lisp/faces.el b/lisp/faces.el
index cf81013118b..ad5b467b9e2 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -2463,7 +2463,11 @@ underline
 
 (defface fixed-pitch
   '((t :family "Monospace"))
-  "The basic fixed-pitch face."
+  "The basic fixed-pitch face.
+This face is intended to be visually distinct from the `default' face on
+graphical frames, even when the `default' face also uses a fixed-pitch
+typeface.  In practice this means that this face should always use a
+different typeface to the `default' face's typeface."
   :group 'basic-faces)
 
 (defface fixed-pitch-serif
--8<---------------cut here---------------end--------------->8---

(2)
The faces are not in fact visually distinct by default on GNU/Linux,
though they are on the non-free macOS and MS-Windows platforms.  This
should be fixed.  I am not sure where to look in the code base, though
-- the different typefaces for default and fixed-pitch on MS-Windows,
for example, aren't defined in faces.el, but presumably somewhere in C.
Could I have a hint?

[1]  https://lists.gnu.org/archive/html/emacs-devel/2021-10/msg00396.html

-- 
Sean Whitton