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

From: Stefan Monnier <[email-masked]>
Date: Sat, 19 Nov 2022 09:55:29 -0500

> Then Emacs does here what we intended it to do: it tries to match the
> variable-pitch font to the attributes of the default font.  And DejaVu
> Sans fails that test on your system, because DejaVu Sans doesn't have
> a variant with the font attributes that are present in misc-fixed font
> you use as the default face's font.

Then maybe the problem is the following: I do not consider
`-misc-fixed-*-r-semicondensed-*-13-*-*-*-*-*-*-*` to include "please
use non-anti-aliased fonts", contrary to the `-fn monospace:antialias=0`
of bug#37473?

I'd actually be happier if Emacs could find an anti-aliased version
of misc-fixed :-)

The only part I could see that "collides" with "DejaVu Sans" is the
"semicondensed" part, but if I change my recipe to add `:width normal`,
I *still* don't get to see my variable-pitch text in DejaVu Sans.

Oh wait... I can recover the behavior I want by selecting

    :family "DejaVu Sans" :foundry "PfEd"

so the problem is the foundry info.  Changing the recipe to use

    -*-fixed-*-r-semicondensed-*-13-*-*-*-*-*-*-*

doesn't help, OTOH (IOW Emacs insists on preserving the foundry even if
I did not explicitly request any particular foundry).

Does it make sense to preserve the `:foundry` attribute when the
`:family` is different?  I always thought of `:foundry` as a weird
detail which only makes sense when selecting a specific implementation
of a given `:family`.  In my experience the foundry is very rarely
used/exposed (e.g., I had no idea what was the foundry to use for
`DejaVu Sans` and I have no idea what "PfEd" means (but my web search
suggests it's not really a "foundry")), and it's rare to have
several foundries for the same font family.

Is there some way to say `:foundry any` in order to override the
default's foundry but without having to choose a particular foundry?

        Stefan

PS: Things become really weird with:

    src/emacs -Q --eval '(progn (custom-set-faces `(variable-pitch ((t (:family "DejaVu Sans" :foundry "*"))))) (add-to-list `default-frame-alist `(font . "-*-fixed-*-*-semicondensed-*-13-*-*-*-*-*-*-*")) (font-lock-mode -1) (insert (propertize "hello" `face `variable-pitch) " world"))'

where "hello" ends up with the following font:

    ftcrhb:-urw-Century Schoolbook L-medium-normal-normal-*-13-*-*-*-*-0-iso10646-1