Subject: bug#57555: 29.0.50; variable-pitch font issue with medium weight default font

From: Eli Zaretskii <[email-masked]>
Date: Mon, 05 Sep 2022 14:57:16 +0300

> From: Amin Bandali <[email-masked]>
> Cc: [email-masked]
> Date: Mon, 05 Sep 2022 03:06:48 -0400
> 
> Eli Zaretskii writes:
> 
> [...]
> >
> > Thanks, but please show the font setup you are using; without that, the
> > "instead of the correct sans-serif variable-pitch font" part is
> > impossible to interpret.
> 
> Thanks for your reply, Eli.  Globally, I'm basically using the default
> font setup that Trisquel GNU/Linux comes with.  Here is a tarball of
> the /etc/fonts/ directory on my system:

Thanks, but I meant the font setup specific to Emacs, i.e.:

  . any set-fontest-font calls in your init files
  . any set-frame-font calls or any other face-related calls in your
    init files that could affect the font selection

Sorry for my imprecise wording.

> > Also, do you have the medium (not regular) variant of the GNU FreeSans
> > font installed?  If not, can you install it and try again?
> 
> As far as I can tell, GNU FreeSans does not have a medium variant;
> only regular, bold, oblique, and bold oblique:
> 
> $ ls /usr/share/fonts/truetype/freefont/FreeSans*.ttf
> /usr/share/fonts/truetype/freefont/FreeSansBoldOblique.ttf
> /usr/share/fonts/truetype/freefont/FreeSansBold.ttf
> /usr/share/fonts/truetype/freefont/FreeSansOblique.ttf
> /usr/share/fonts/truetype/freefont/FreeSans.ttf
> 
> I suppose what might be happening here is that Emacs now tries to use
> a medium variant for the variable-pitch GNU FreeSans as well (even
> though I'd expect that 'medium' to only apply to the font I explicitly
> mentioned it for, i.e. Source Code Pro), which does not have such a
> variant, and then it falls all the way back to "misc-fixed".  What is
> a bit curious, though, is that this doesn't seem to affect italic
> variable-pitch text, and Emacs correctly picks GNU FreeSans oblique
> for that just fine.

I think this means that Emacs gives greater importance to consistency
in weight than to consistency of the family.  Not sure if that is TRT.

> Right.  For what it's worth, I find Emacs picking misc-fixed for
> variable-pitch text more than just a minor annoyance: for long hours
> of use, I find misc-fixed it considerably less comfortable to my eyes
> than GNU FreeSans (for proportional/variable-pitch) or Source Code Pro
> medium (for monospace).

Can't you customize the variable-pitch face to specify the FreeSans
family, or even to specify the exact font you want Emacs to use?  That
should allow you to override any built-in heuristics that Emacs uses
when it has no other restrictions.