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

From: Dmitry Gutov <[email-masked]>
Date: Wed, 21 Dec 2022 15:40:06 +0200

On 21/12/2022 11:38, Gregory Heytings wrote:
> 
>>
>> Too bad the recent changes by Gregory didn't improve this scenario.
>>
> 
> Which scenario?  If I put

Here are a bunch of scenarios, most of them pretty odd. I was primarily 
testing scenario number 2.

> (set-face-attribute 'default nil :height 110 :font "Inconsolata_dz")
> 
> in a init file, everything works as I'd expect it to work.

1. If I put this in my init file and start Emacs, during startup it 
blinks to a weird font (narrow window, narrow characters), but then 
finishes startup with a window that looks reasonable (both the size of 
the window and the shape of characters). 'M-x describe-face RET default' 
reports "Inconsolata_dz" as family.

2. I start 'emacs -Q' and evaluate (set-face-attribute 'default nil 
:height 105 :family "Inconsolata_dz") in *scratch*. I get that 
weird-looking font that blinks briefly in scenario 1. 'M-x describe-face 
RET default' reports "Ubuntu Condensed" as family.

3. I start from the end of 2. and press 'C-x 5 2'. The new window pops 
up with reasonable-looking font and size. 'M-x describe-face' reports 
"Inconsolata_dz" as family.

4. I start with 'emacs -Q' and evaluate (set-face-attribute 'default nil 
:height 110 :family "Cascadia Mono"). This works fine on the first try 
without splitting frames, 'M-x describe-face' reports "Cascadia Mono". 
Same with "Inconsolata LGC".

5. I start my regular init script with (set-face-attribute 'default nil 
:height 105 :family "Inconsolata LGC") in it. Then in scratch evaluate 
(set-face-attribute 'default nil :height 105 :family "Inconsolata_dz"). 
I get another funny-looking font. 'M-x describe-face' says it's "Purisa".

6. I start with 'emacs -Q' and evaluate (set-face-attribute 'default nil 
:height 110 :family "Cascadia Mono") there. Works as expected. Then I 
evaluate (set-face-attribute 'default nil :height 105 :family 
"Inconsolata_dz") -- the font size changes slightly (downward), but the 
face remains the same. 'M-x describe-face' corroborates that.

I think the problems here are:

- Inconsolata_dz only works in frames created later.
- Setting font attributes may result in unpredictable results, they 
depend on the previous font spec. Even though the explicit attributes 
are all rewritten to new values every time.
- Unknown font families fail silently (switching to something else under 
the hood). Perhaps it was also the case before, but it adds to the 
confusion.