You are not logged in.

#1 2024-10-17 22:01:39

shestifled
Member
Registered: 2024-10-17
Posts: 3

[Solved] Qt 6.8 ignores fontconfig. (anti-aliasing overwriten by xrdb)

Everything was tested on a fresh install in a VM.

~/.config/fontconfig/fonts.conf:

<fontconfig>
	<match target="font">
		<edit mode="assign" name="antialias">
			<bool>false</bool>
		</edit>
	</match>
</fontconfig>

The above configuration should disable all font anti-aliasing, it applies to all GTK3 (thunar, xfce4-panel), GTK4 and Qt 5 (mumble, quasselclient, qt5ct) applications, but is ignored by Qt6 (qt6ct, audacious, telegram-desktop). Previous versions of Qt 6 respected fontconfig settings.

Searching online I found some reports of this happening, and it seemed to be caused by qt6 using its built-in freetype, instead of the one supplied by the system, so i rebuilt the qt6-base package myself, and the configuration said that it was using system freetype.

If this is intended, and system fontconfig usage is deprecated, is there another method for changing parameters per font? I used fontconfig to disable anti-aliasing on specific fonts. While its still possible to disable it in Qt 6 by changing font settings in xfce4, this will apply to all fonts.

Am i doing something wrong or is this an actual bug that i should be reporting to Qt developers instead of crying on archlinux forums

Last edited by shestifled (2024-10-18 19:26:54)

Offline

#2 2024-10-18 06:27:12

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 72,626

Re: [Solved] Qt 6.8 ignores fontconfig. (anti-aliasing overwriten by xrdb)

While its still possible to disable it in Qt 6 by changing font settings in xfce4, this will apply to all fonts.

But the suggested fontconfig would do exactly that?

I assume the xfce4 config take precedence, possibly because of a platform plugin? Or it prefers xrdb?

fc-conflist # with your personal fonts config
xrdb -q | grep -i xft

Previous versions of Qt 6 respected fontconfig settings.

Font clipping was broken as well, so there's a good chance this is a regression bug in Qt 6.8 w/ major changes to the rasterizer.

Online

#3 2024-10-18 07:06:40

shestifled
Member
Registered: 2024-10-17
Posts: 3

Re: [Solved] Qt 6.8 ignores fontconfig. (anti-aliasing overwriten by xrdb)

seth wrote:

But the suggested fontconfig would do exactly that?

The provided config is only an example, my actual config is more complex and disables anti-aliasing for specific fonts.

seth wrote:

I assume the xfce4 config take precedence

Turns out this is actually the case! For whatever reason the Xft.antialias entry in the xrdb overrides my fontconfig, but only in qt6!

Here is what my xrdb looks like when set up by xfce4:

Xft.antialias:	1
Xft.hinting:	1
Xft.hintstyle:	hintfull
Xft.rgba:	rgb
Xft.dpi:	96
Xcursor.theme:	default
Xcursor.size:	16
Xcursor.theme_core:	1

If I remove the Xft.antialias option (not setting to 0, just removing it completely), all application still apply anti-aliasing to all fonts by default, and now I'm able to disable it per font in Qt 6 applications! This solution is not perfect, as changing any xrdb altering settings in xfce4 will add the entry back.

If every other framework (gtk, qt5) prioritizes fontconfig over xrdb, does it mean its a bug?

Offline

#4 2024-10-18 11:41:26

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 72,626

Re: [Solved] Qt 6.8 ignores fontconfig. (anti-aliasing overwriten by xrdb)

It's certainly an odd choice to have the general xft config obliterate the fontconfig details and if this has behaved different w/ Qt 6.7 (assumign you didn't also update/switch to xfce4) it's a regression and probaby undesired bug.
=> https://bugreports.qt.io/browse/QTBUG-5 … 0%22xft%22 actually has quite a bunch of hits and https://bugreports.qt.io/browse/QTBUG-56809 suggests the Qt5 behavior was objected.

Online

#5 2024-10-18 19:25:40

shestifled
Member
Registered: 2024-10-17
Posts: 3

Re: [Solved] Qt 6.8 ignores fontconfig. (anti-aliasing overwriten by xrdb)

My solutions for now:

Adding this file to xfce4 session autorun:

#!/bin/sh
echo """Xft.hinting:1
Xft.hintstyle:hintfull
Xft.rgba:rgb
Xft.dpi:96
Xcursor.theme:default
Xcursor.size:16
Xcursor.theme_core:1""" | xrdb

Of course you should use your own settings for the cursor and hinting and stuff, and it will reset every time you change stuff in the settings manager.

Thanks for all the help! I didn't even know that anti-aliasing options can be applied through xrdb!

Offline

#6 2024-10-18 19:40:35

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 72,626

Re: [Solved] Qt 6.8 ignores fontconfig. (anti-aliasing overwriten by xrdb)

xrdb -q | grep -vi antialias | xrdb

Online

Board footer

Powered by FluxBB