Subject: bug#67810: 29.1; fonts use synthetic bold on Linux / pgtk

From: Eli Zaretskii <[email-masked]>
Date: Wed, 13 Dec 2023 15:39:40 +0200

> From: Tim Ruffing <[email-masked]>
> Cc: [email-masked]
> Date: Wed, 13 Dec 2023 14:28:58 +0100
> 
> On Wed, 2023-12-13 at 14:39 +0200, Eli Zaretskii wrote:  
> > I don't think Emacs creates such "synthesized" fonts; are you sure it
> > does? I think Emacs just asks fontconfig for a bold font; it has no
> > knowledge whether it gets a real or a synthetic font.
> 
> Well, *something* in the Emacs font rendering stack creates this bold
> variant. font-config can't create it, it's just a config layer but
> doesn't handle rendering. I'm really not an expert here with so many
> pieces in the stack but AFAIU Cairo can be asked to do so, and will
> just delegate to freetype. (Harfbuzz can also do it, see
> https://github.com/harfbuzz/harfbuzz/pull/4097 , but I see the bold in
> emacs when I configure --without-harfbuzz). 
> 
> The thing is: If I query font-config manually, it tells me to use the
> regular font and not to embolden it (see below) .Emacs doesn't respect
> this. 
> 
> So what we should have is a way to disable the emboldening. When I set
> my font-config settings such that emboldening is disabled, pango
> apparently respects this (as apparent from the font selection dialog)
> but emacs doesn't.

Maybe this is done by the calls to the font backend with FC_EMBOLDEN
parameter?  I'm no expert on these font backends, but maybe you could
play with those calls and see if disabling them gets you what you
want?  You can find the relevant code by searching the C sources for
FC_EMBOLDEN.