Subject: bug#59347: 29.0.50; `:family` face setting ignored

From: Eli Zaretskii <[email-masked]>
Date: Tue, 22 Nov 2022 16:52:17 +0200

> Date: Tue, 22 Nov 2022 14:39:16 +0000
> From: Gregory Heytings <[email-masked]>
> cc: [email-masked], [email-masked]
> 
> > Why do you expect to get a variable pitch font?
> >
> 
> The variable-pitch face should use a variable pitch font, shouldn't it? 
> Unless there are no such fonts installed on the computer of course, in 
> which case it could fall back to a monospace font.

You know it and I know it, but how should the code which examines the fonts
know it?  AFAICT, nothing tells it to reject fixed-pitch fonts.  Or did I
miss something?

> > Emacs tries to find a font from the same family, but if that fails for 
> > some reason, all bets are off wrt whether the font we find will be 
> > variable-pitch or not.  Or what am I missing?
> 
> Why should the weight of the default face influence the font selected for 
> the variable-pitch face

Because if the default face is bold, so should be other faces, preferably.
To keep a consistent appearance, so to say.  And the same goes for slant and
width.

> to the point that even when variable pitch fonts 
> are installed on the computer, they are all flatly rejected because they 
> do not explicitly support say the 'semi-bold' weight?  The weight of the 
> default face should only influence the weight of the other faces

How are "other faces", where you agree that the weight should matter,
different from the variable-pitch face, where you don't agree?

Anyway, I'm okay with doing what you suggest as a fallback, if the code we
have now somehow didn't produce satisfactory results.  Provided we can
define reasonable criteria for what is "satisfactory".  But I don't think
it's right to throw away these 2 attributes to begin with, no.

> With a 'semi-bold' default face, a 'bold' variable pitch font is a
> legitimate candidate for the variable-pitch face.

But your patch doesn't "loosen" just one attribute, it does that with all 3
in one blow.  Maybe if we "loosen" just one, we will be able to find a match
for the other two.  I don't think font_score guarantees that, does it?