[Interest] Qt and font weight on Linux

Benjamin TERRIER b.terrier at gmail.com
Fri Jan 3 17:40:31 CET 2020


Hi,

I have an issue on a computer running KUbuntu 19.10.

Basically the issue is that Qt does not handle properly the font weights.

For instance for "Ubuntu Mono" I have the Regular and Bold fonts installed
and they are properly registered in fontconfig:

    fc-match "Ubuntu Mono"
    UbuntuMono-R.ttf: "Ubuntu Mono" "Regular"

    fc-match "Ubuntu Mono:Bold"
    UbuntuMono-B.ttf: "Ubuntu Mono" "Bold"

However, Qt applications fail to change the weight. Be it in my own
software or in Qt Creator, be it using Qt official packages or Ubuntu
provided packages, with widgets or Qt Quick: the font always appears as
"Regular". Using `QFontInfo::styleName()`, I can
confirm that it is always the "Regular" variant that is used.

When trying with the "Ubuntu" family (instead of "Ubuntu Mono") for which I
have all variations installed (Light, Thin, Regular, ...),
I am only able to have Regular and Bold texts.

I have tried on other computers (Windows, KDE Neon and Ubuntu 18.04) and
for all of them it is working fine.

Also when using Kate I am able to use Ubuntu Mono in bold.

So I am wondering what can be causing this kind of issue?
Could it be some incompatibility between Qt official packages and the
latest Ubuntu? Bu then using the distro packages should solve the problem.
Or could it be a system configuration issue? But then Kate and fc-match
shouldn't work either.

BR,

Benjamin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200103/314f4ec9/attachment.html>


More information about the Interest mailing list