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

From: Eli Zaretskii <[email-masked]>
Date: Sun, 04 Dec 2022 16:21:46 +0200

> Date: Wed, 30 Nov 2022 15:38:37 +0000
> From: Gregory Heytings <[email-masked]>
> cc: [email-masked], [email-masked]
> 
> I attach a screenshot of the font preference box in Firefox.  In that 
> screenshot you see the three most general font families: Serif, Sans Serif 
> and Monospace.  The Serif and Sans Serif families are meant for variable 
> pitch fonts.  Emacs uses these same "Sans Serif" and "Monospace" families.

Emacs uses the same families because we have it in
face-font-family-alternatives, and/or because Fontconfig has the same notion
of families.  There's no magic here, and btw face-font-family-alternatives
can be customized by the user to yield completely different preferences.

But nothing in the family name tells Emacs it _must_ produce a
variable-pitch font.  Those are just lists of font names, that's all.  In
your example, you consider DejaVu Sans to be a proper font for that family,
but the name "DejaVu Sans" doesn't appear anywhere, so why is it correct?

> > You asked for ultra-heavy and heavy weight, but got bold -- why is that 
> > TRT?
> 
> Same answer: it is TRT because the "family = Sans Serif" specification of 
> the variable-pitch face is obeyed.

This doesn't make sense to me: why should Emacs obey "family = Sans Serif",
but not "weight = ultra"?

> > Why is it "clear" that font selection should do what you expect here, 
> > given that the only (weak) indication that we are after a variable-pitch 
> > font is the family?  Why do you consider it so preposterous that Emacs 
> > comes up with a semi-bold font, when you ask for a semi-bold font?
> >
> 
> You seem to misunderstand how font selection works.

Stop right there.  If you still wonder how you got a semi-angry response in
the dispute about narrowed-locking, this arrogant attitude is the reason.
You are always right and anyone who disagrees "doesn't understand".  You are
dangerously close to getting the same reaction in this discussion.  If you
want a rational, technical, efficient discussion, please drop the attitude
and start leveling with me.  Do not try to tell me what I do and don't
understand, and do not reply with arrogant responses like this one:

> > How do you know it wasn't considered?
> 
> I debugged the code.

Instead, please assume that I know enough about the code to have good
reasons for asking my questions, and please humor me with full, detailed
responses.  That is the only way to convince me that you are right.

So once again, here are my questions:

  . why do you think Emacs must return only variable-pitch fonts for a spec
    that includes family = Sans Serif"? where and how should Emacs get the
    indication that only variable-pitch fonts are acceptable in that case?
  . why do you consider the family attribute of a face be more important
    than other attributes? if not all the attributes of a spec are "equal"
    in their importance, which attributes are more important, and why? and
    if bold is fine when semi-bold was requested, what about other weights,
    like ultra-light -- are they also okay? if not, why not? what are the
    criteria here and with other similar attributes?

Without getting detailed answers to these questions, I don't see how we can
continue the discussion, nor why we should; and there's no real reason for
me to change my mind that what Emacs does now with these specs is correct
and expected.

> There are, on my system, no less than 166 fonts in the "Sans Serif" 
> family.  It just happens that none of them explicitly supports the 'heavy' 
> weight / has no explicit 'heavy' variant.  But that is not a sufficient 
> reason to reject all those 166 fonts.  What Emacs should do, what others 
> programs do, and what Emacs would do with the patch, is to select the best 
> possible font among those 166 fonts.

That would mean the user cannot specify a weight meaning "give me that
weight or admit failure to find a suitable font".  And how does that make
sense?

> I don't know what else I could say to convince you.

You could start showing data and details of the code workings, instead of
talking slogans and insults.