Subject: bug#51277: 27.1; menu-set-font not loading correct font

From: Eli Zaretskii <[email-masked]>
Date: Tue, 19 Oct 2021 15:43:46 +0300

[Please use Reply All to reply, so that the discussion gets recorded
on the bug tracker.]

> Date: Tue, 19 Oct 2021 08:20:38 -0400
> From: Jesse Sheidlower <[email-masked]>
> 
> > What happens if you invoke Emacs like this:
> > 
> >   emacs -Q -fn 'Operator Mono SSm'
> > 
> > and then type this:
> > 
> >   M-x (set-face-attribute 'default nil :weight 'book) RET
> > 
> > Does that produce the expected effect?
> 
> Depends on what I should expect!

You should expect to see the "book" variant of the font.  Isn't that
what you wanted?

> At the first command, Emacs starts with the bold variant; running the second command returns '[No match]', and we stay in the bold variant.

Sorry, I meant to say "M-:" instead of "M-x".  It was a typo.

> > Sounds like some problem with that font.  Does this work correctly
> > with other fonts that have the "book" variant?
> 
> No, it doesn't, but the only other font I have with a "book" variant happens to be from the same foundry. Hoefler Decimal Book in fact opens the file for Decimal-XBlack, even though there is a file for Decimal-Book.
> 
> I did ask someone at Hoefler Type Foundry about this, and they said they weren't aware of anything that could be causing it.

Then I suggest to try with some other fonts.

> I don't know how Emacs does this under the hood

No one does, unfortunately.

> but the fact that menu-set-font does correctly display all the variants with their correct names, but then loads something different, suggested that there might be a problem with Emacs (which is why I filed a bug report, instead of just assuming that I'm the one fucking something up).

No, that doesn't necessarily mean anything.  the font selection dialog
is something implemented in GTK, I believe, and it just shows the
fonts that GTK knows about.  When Emacs tries to use that font, it
could find some problems with it, and that could lead to what you see.