You are not logged in.

#1 2020-05-03 12:02:58

nikatar
Member
Registered: 2019-03-16
Posts: 9

Different fonts in Qt and GTK applications

Hi!

Different fonts in Qt and GTK applications, although the settings  are the same. In Qt applications, the font is much thicker. I also noticed, that for some reason GTK does not allow to set the bold font: for example, there is no difference between Source Sans Pro Bold and Source Sans Pro Regular 10.

The font is everywhere - Source Sans Pro Regular 10. DPI - 96. If it matters, the screen resolution is 1366x768, the diagonal is 12.5 ".

DE - XFCE.

Settings in XFCE (XSETTINGS)

Xresources

Qt platform - qt5ct. fonts.conf

For comparison:
1) GTK
2) Qt

P.S. I apologize if you were confused by the Cyrillic in the screenshots, but I hope everything is clear

Offline

#2 2020-05-03 22:39:17

nikatar
Member
Registered: 2019-03-16
Posts: 9

Re: Different fonts in Qt and GTK applications

I think, that qt and gtk render the fonts differently. Can someone confirm this conjecture? It is an important issue. Someone had to investigate it.

Offline

#3 2020-05-04 06:40:13

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,364

Re: Different fonts in Qt and GTK applications

They definitely do, they are different toolkits with different rendering code. Though I'm admittedly not the most sensitive in regards to general font rendering and can't claim to see/feel a noticeable difference on my systems.

FWIW it might be that themes make a difference here too and you might want to check back/verify with something "official" like adwaita in the GTK case.

Last edited by V1del (2020-05-04 06:40:48)

Offline

#4 2020-05-05 00:19:14

nikatar
Member
Registered: 2019-03-16
Posts: 9

Re: Different fonts in Qt and GTK applications

I installed and tried  ttf- and otf-versions of fira-sans from repos. In otf-version there is a strong thickening of the font. The look of  ttf-fonts is much better and closer to gtk. It turns out that there is a problem with ttf vs. otf in qt.

Can anyone shed some light on this issue?

Offline

#5 2020-05-05 00:52:21

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: Different fonts in Qt and GTK applications

Inside OTF files can be TrueType or "CFF" fonts. The code in the freetype2 library for rendering CFF is different from the one for TrueType. The CFF rendering code has a "darkening" feature that can be enabled for small sizes of fonts. This darkening feature is normally disabled on Linux but I guess Qt has it enabled by mistake.

If you are interested in too much details:

About why this darkening feature exists, on Windows and OS X and Android and ChromeOS the fonts are rendered with gamma correction. The gamma correction makes text look super light at small sizes and that's why there's that darkening feature in the rendering code.

On Linux this darkening should normally be off because the gamma correction is missing. This is broken about Linux font rendering. If you are interested in this gamma correction stuff, this article on the freetype2 website explains it:

https://www.freetype.org/freetype2/docs … neral.html

There's a ten year old bug report about the broken gamma correction here:

https://gitlab.freedesktop.org/cairo/cairo/issues/2

Offline

Board footer

Powered by FluxBB