[Fontconfig] Can I specify different weights for normal and bold ?

Akira TAGOH akira at tagoh.org
Wed Nov 22 08:55:58 UTC 2023

On Wed, Nov 22, 2023 at 5:22 AM Ken Moffat <zarniwhoop at ntlworld.com> wrote:
> Is it possible to change the default weights of a locally-installed
> font ?  If not, it seems to me that installing anything other than
> normal and bold is a waste of time unless you are creating a web
> page using specific weights, and for that you probably want to use
> woff fonts ?

Some applications may rely on "style" property to lookup a font. If
you modify it, the result may be more robust. However, It may not even
work if a font file picked up by fontconfig contains multiple variants
and applications do the real job with the low-level APIs, because we
can't modify metadata in a font.

> I have noticed so far in perhaps-related things:
> 1. In libreoffice writer (7.5) Noto Serif appears as separate fonts for
> (regular), Black, ExtraBold, Light, Medium, SemiBold (I didn't
> install any weights less than light) which implies they are treated
> as different fonts ?

I'm not sure what exactly "different fonts" means here though, some
applications have their own font management and take care of a variant
of the font family such as Noto Sans Regular, Noto Sans Medium, Noto
Sans Bold as one font family literally such as Noto Sans.
Unfortunately this isn't a feature provided by fontconfig so far.
If they don't identify them that way, they just recognize them as it is.

> 2. Attempting to force emboldening on some very faint fonts, such as
> FreeSerif, (with attempts to also address weight "for non-cairo
> apps") the results differ greatly:
> 2.1 In firefox, both normal and bold are now bold (the non-cairo
> part is needed).
> 2.2 In webkitgtk (epiphany) both normal and bold become heavier on
> *some* fonts - sometimes bold becomes Heavy and ugly, other times it
> looks usable.  Yes, I realise that embolden is intended to cater for
> fonts that lack a bold variant, but nothing ventured, nothing gained.

That really depends on fonts. and is completely out of the scope for
fontconfig. fontconfig doesn't get involved with the rendering part at

> For both firefox and epiphany, the degree of enhanced weight seems
> to differ between dark and light modes - but that might be my
> eyesight.
> 2.3 In qt5webengine (falkon) no change.  I've not installed any
> other kde apps, so perhaps I'm missing an app to configure it.
> And it doesn't seem to accept any envvars to force dark mode.
> 2.4 For completeness, no change in libreoffice.
> Thanks for any help.
> ĸen
> --
> This is magic for grown-ups; it has to be hard because we know there's
> no such thing as a free goblin.
>    -- Pratchett, Stewart & Cohen - The Science of Discworld II


More information about the Fontconfig mailing list