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

From: Dmitry Gutov <[email-masked]>
Date: Thu, 22 Dec 2022 22:32:04 +0200

On 22/12/2022 01:39, Gregory Heytings wrote:
> 
>>
>> Here are a bunch of scenarios, most of them pretty odd. I was 
>> primarily testing scenario number 2.
>>
> 
> Thanks for your detailed reply.
> 
>>> (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.
>>
> 
> Can you please try an init file with only that line, and that exact 
> line? Note that your original recipe used ":family", where ":font" 
> should be used (and is used in the call to set-face-attribute above).

With :font, the recipe seems to be working fine. Thanks!

I've always used :family for this purpose in the past.

>> 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.
>>
> 
> Again, can you try to evaluate (set-face-attribute 'default nil :height 
> 110 :font "Inconsolata_dz") (with ":font", not ":family") instead, and 
> tell us what happens?

The behavior seems to be as expected: this font is assigned in the 
current frame.

> Can you try your other recipes, using ":font" where you used ":family", 
> and tell us whether what happens is what you expected?

Almost good, with one problem jumping out, however:

- Evaluate (set-face-attribute 'default nil :height 105 :weight 'regular 
:font "Inconsolata LGC"), result:

              Family: Inconsolata LGC
           Foundry: PfEd
             Width: normal
            Height: 105
            Weight: regular

- Then I evaluate (set-face-attribute 'default nil :height 110 :weight 
'semi-light :font "Cascadia Mono"), the result is:

            Family: Inconsolata LGC
           Foundry: PfEd
             Width: normal
            Height: 105
            Weight: regular

Note the weight. Cascadia Code seems to be thicker than average as a 
font, so the weight of the regular font jumps out, and it was easy to 
notice.

If I, however, follow (set-face-attribute 'default nil :height 105 
:weight 'regular :font "Inconsolata LGC") with (set-face-attribute 
'default nil :height 110 :weight 'semi-light :family "Cascadia Mono") -- 
note :family, the resulting font looks fine, and is described as:

            Family: Cascadia Mono
           Foundry: SAJA
             Width: normal
            Height: 109
            Weight: semi-light

Starting the session with (set-face-attribute 'default nil :height 110 
:weight 'semi-light :font "Cascadia Mono") also has this problem.

However, switching from :family to :font -- (set-face-attribute 'default 
nil :height 110 :weight 'semi-light :family "Cascadia Mono") followed by 
(set-face-attribute 'default nil :height 110 :weight 'semi-light :font 
"Cascadia Mono") -- is a no-op.