Subject: Re: bug#52905: 29.0.50; "fixed-pitch" face doesn't respect the font in "default-frame-alist"

From: Dima Kogan <[email-masked]>
Date: Thu, 30 Dec 2021 23:34:58 -0800

Hi Eli.

Broadly-speaking the complaint is:

  I've been doing what the docs tell me to do for many years, and it has
  been looking nice for many years, and now it doesn't look nice
  anymore

I just looked at version control, and the thing that actually made
things weird in THIS case is the update to org 9.5:

  https://github.com/emacs-mirror/emacs/commit/bf9ec3d91a79414deac039f7bf83352a9b0a9a85

It made the org-meta-line face inherit from "fixed-pitch", which is
fine. More notes follow...

> You seem to assume that the default face's font is also the font
> used by the fixed-pitch face?  There's no basis for this assumption:
> as long as a face defines :font or :family attributes, the font for
> that face is selected independently.  The "Monospace" family
> doesn't stand for "the monospace font selected fro thedefault face",
> it stands for some font that belongs to the "Monospace" family.  What
> exactly does that family include depends on your font back-end and the
> fonts installed on your system, but Vera Sans Mono doesn't sound like
> it shouldn't be in that family, it sounds right to me.

Yes. That is exactly what it's doing today. But it isn't nice. If emacs
has a "default" font, and that font happens to be a fixed-pitch font,
then the "fixed-pitch" face should use that default font. Otherwise, the
"default" font choice is ignored in arbitrary places, creating a poor
user experience. I think the ways to fix this are:

1. Not having a default font at all

2. Some logic that vaguely does (in pseudo-code):

   (set-font-for-face
     fixed-pitch
     (if (font-is-fixed-p default-font)
       default-font
       (get-some-fixed-pitch-font)))

   (set-font-for-face
     variable-pitch
     (if (font-is-variable-p default-font)
       default-font
       (get-some-variable-pitch-font)))

   Is there an easy, reliable way to tell if a given font is fixed or
   not? If so, this would be a good way to honor the user's choice of
   default font.

Thanks!