Subject: bug#52493: 29.0.50; Setting Inconsolata up in init.el makes default face rendered wrong

From: Eli Zaretskii <[email-masked]>
Date: Thu, 16 Dec 2021 09:29:24 +0200

> Cc: [email-masked]
> From: Dmitry Gutov <[email-masked]>
> Date: Thu, 16 Dec 2021 01:43:31 +0300
> 
> >> (set-face-attribute 'default nil :height 110 :family "Inconsolata_dz")
> >>
> >> See the attached screenshot with comparison (master is on the left).
> > 
> > Indeed, weird.  What does the below show?
> > 
> >    M-: (face-font 'default) RET
> > 
> > after you evaluate the above in "emacs -Q"?
> 
> "-DAMA-Ubuntu Condensed-regular-normal-normal-*-29-*-*-*-*-0-iso10646-1"
> 
> So... not the right family and it's "condensed", for some reason.
> 
> For comparison,
> 
> (set-face-attribute 'default nil :height 110 :family "Ubuntu")
> 
> results in
> 
> "-DAMA-Ubuntu-regular-normal-normal-*-29-*-*-*-*-0-iso10646-1"
> 
> And by default (without any set-face-attribute calls),
> 
> (face-font 'default) evaluates to
> 
> "-DAMA-Ubuntu Mono-regular-normal-normal-*-35-*-*-*-m-0-iso10646-1"
> 
> > And how does it differ
> > from the same in a version of Emacs that predates the changes of the
> > mode-line face?
> 
> Current emacs-28 returns
> 
> "-PfEd-Inconsolata_dz-normal-normal-normal-*-29-*-*-*-m-0-iso10646-1"
> 
> Regarding "version of Emacs that predates", I wasn't sure which commit 
> to pick exactly, but 756b8a5f1bd28aeadc804 also returns that value, and 
> doesn't have the described problem.
> 
> > Also, what happens if you invoke Emacs like this:
> > 
> >    $ emacs -Q -fn Inconsolata_dz
> 
> It doesn't look as narrow, and (face-font 'default) evaluates to
> 
> "-PfEd-Inconsolata_dz-medium-normal-normal-*-32-*-*-*-m-0-iso10646-1"

Thanks.  I think this means that Emacs 29 on master now rejects the
Inconsolata_dz font for some reason, or thinks it finds a better
match.  The fact that it picks a condensed family is probably
secondary; the main issue here is that the font family you requested
is rejected.

Does that family have the regular weight?  If not, maybe that's the
reason it is rejected, and you need to also require some specific
:weight value in your set-face-attribute call.

Also, maybe running

  $ FC_DEBUG=1282 emacs -Q

will give us a clue of what happens.  See

  https://www.freedesktop.org/software/fontconfig/fontconfig-user.html#DEBUG

for where I took that weird value.

Robert, any other ideas?

If this doesn't help, I'm afraid the only way forward is to step
through the code which selects a font when you specify the family for
the default face, and see what happens there and why.