GNOME ignores the fontconfig rules
Opened this issue · 3 comments
About
For some strange reason, GNOME DE completely ignores any fontconfig rule to set the font antialiasing method, meaning that it is completely impossible to make any custom value set with fontconfig to be respected by the environment.
While this is not a critical issue, as GNOME uses the grayscale antialiasing method by default, there are a few Linux distributions that change this setting to the subpixel mode, with Ubuntu being one of them.
"GNOME-way"
GNOME DE has its own configuration methods, that are preferred over the freedesktop standards. These configurations can be easily accessed and modified through the gsettings
utility. There are absolutely no other way to make changes to stuff like antialiasing method or hinting without the gsettings
tool.
Solution
The only possible solution to this issue is an additional scriplets, that will handle the configurations for GNOME DE using the gsettings
tool.
Current antialiasing method can be queried with command:
gsettings get org.gnome.desktop.interface font-antialiasing
Grayscale antialiasing method can be set with command:
gsettings set org.gnome.desktop.interface font-antialiasing grayscale
Reverting the changes to the default values is also possible with:
gsettings reset org.gnome.desktop.interface font-antialiasing
Decided to make a few tests with KDE spin of Fedora just to make sure that this problem is GNOME-specific. Results: This problem is GNOME-specific. KDE Plasma respects all the fontconfig rules.
Started working on this problem and it's, uh... quite troublesome. Not only is the XDG_CURRENT_SESSION
environment variable inaccessible on sudo run (without the -E
flag), but the gsettings
utility for GNOME configuration relies heavily on D-Bus, making it very hard to make any changes under sudo.
The next and main problem is automatic installation through the package manager. Here it becomes simply impossible to make such calls to the user environment.
So the only possible way to implement this would be a special profile.d
script, which should check the environment only once after startup and make all the necessary gsettings
calls.
Found this amazing feature, that allows to override the default GTK apps configuration, also works for GNOME "registry". It can be done by placing the file <NAME>.gschema.override
in /usr/share/glib-2.0/schemas/
:
[org.gnome.desktop.interface]
antialiasing='grayscale'
Note that this is not a fully functional example. In fact, I'm not even sure it works at all.
I am not entirely sure this will work out as intended, but it's definitely a much better way to handle these settings.
Example usage here.