How do font-settings in gnome, kde and xfce work

gnomekdesettings

My Debian 8 system (Jessie) is primarily an xfce system, but I also use gnome and kde programs. I did not install any desktop environment, but I start my xsession with an .xsession file. Problem is, I cannot get the fonts (and other UI aspects) right.

Tools

First I don't know what tool to use. There is kde's systemsettings and there is gnome-tweak-tool. I do have a gnome-settings-daemon running. Changes made in gnome-tweak-tool immediately manifest in thunderbird and gnome-tweak tool itself, but affect e.g. krusader and k3b only after I restart them. But even then the fonts are too big, but at least there is an effect.

Systemsettings does not seem to have any effect at all on running applications and when I restart a kde application, its fonts appear to be reset to some default setting,

Gnome-tweak-tool offers only very few settings, while systemsettings allows to set the menu font, the toolbar font etc. separately. So I assume gnome must generate the fine-grained settings based on a few settings made by myself in a way which is "best for me".

Xfce has its own xfce4-appearance-settings tool, but it does not seem to affect the fonts of applications and allows setting a single default font only. Oh, and then there is qtconfig, which seems to come in two versions, one for qt4 and qt5. I probably even missed a few.

Currently, the fonts I see do not correspond to the font-settings of any of those tools.

Questions

  • Anyways, I really would like to understand how this whole thing is supposed to work. The interactions between the various setting tools and the applications and where they store their data is a mystery to me.
  • Is there an established standard how these settings tools interact?
  • Additionally, if someone can show me a way to dispose of all this magic, I'd be most grateful. In the old days, setting up xrdb took time, but at least it was a process I could understand and it converged.

Specifically

  • What happens when I change the theme?
  • Do the various setting tools overwrite each other's data?
  • What do the (xfce/gnome) settings-daemons do?
  • What does dconf do?

Best Answer

This answer is not fully canonical--see Answerer's note at the end.

In this answer, I intend to provide concise explanations based on actual experience in Debian-based distributions (Xubuntu and Debian Xfce). Anyway, I have confirmed that the fonts settings doesn't take effect immediately for Qt applications in GTK+ environment of Debian.

Regarding tools

First I don't know what tool to use.

If you are an experienced user, don't use any third-party configuration tool.

For convenience, users tend to use such tools like GNOME Tweak Tool. For best compatibility however, prefer to use graphical configuration tools provided by the desktop environment or respective toolkits. Else, use more advanced tools such as Dconf, Xfconf, or GSettings.

Oh, and then there is qtconfig, which seems to come in two versions, one for qt4 and qt5. I probably even missed a few.

Use qt4-qtconfig for Qt4, and similarly use qt5ct for Qt5.

To check which version of Qt used by particular application, trace the package dependencies using APT. For example, I have VLC installed in Xubuntu. Since VLC is using Qt, I can query the APT cache and use 'qt' as the keyword to filter any Qt dependencies.

$ apt-cache depends vlc | grep 'qt'
  Depends: libqtcore4
  Depends: libqtgui4

In this case, the result hinted that VLC is using Qt4 toolkit.

Another way is to check if any Qt packages have been installed. This can be done by running Dpkg command. I choose to filter the package that contains these keywords, 'libqt' and 'gui', since the earlier APT command above has hinted so.

$ dpkg-query -W | grep 'libqt' | grep 'gui'
libqtgui4:i386  4:4.8.5+git192-g085f851+dfsg-2ubuntu4.1

In this case, the result is showing Qt4 of version 4.8.x is installed. In case Qt5 package is installed, the result will contain libqt5gui5 instead of libqtgui4. Naming is different for Qt5, which is why I use grep twice to filter the result.

Currently, the fonts I see do not correspond to the font-settings of any of those tools.

As hinted earlier by L. Levrel, the system setup is messy. Never mind for GNOME/KDE/Qt applications, but running gnome-settings-daemon in Xfce system? Xfce has its own settings daemon xfsettingsd that is provided by this package xfce4-settings in Debian.

Font settings discrepancy

In the following screenshots, I am running Xfce Appearance, Qt 4 Settings and VLC media player in Xfce desktop environment, using Xubuntu and Debian Xfce. Then, I changed the default font from "Droid Sans (Regular)" to "Droid Sans (Bold)" at same font size 10.

For Xubuntu, the font settings were applied immediately for both GTK+ and Qt applications. The font specified in Xfce Appearance was sufficient to affect system wide, regardless of toolkit used.

Font settings in Xubuntu 14.04

For Debian Xfce, the font settings were applied immediately for GTK+ applications only. I had to use Qt 4 Settings to change default font in Qt, from "Sans Serif (Normal)" to "Droid Sans Mono (Regular)". I also had to manually save from the menu bar before the changes were applied.

Font settings in Debian Xfce 8

Despite both Xubuntu and Debian Xfce were running xfsettingsd, Debian Xfce did not honour the font settings automatically for some reason. Possible clue: Debian Xfce may be missing certain packages that allow Qt applications to read system settings automatically.

Regarding questions

Is there an established standard how these settings tools interact?

Likely no. This is why user should not use third-party tool to configure system settings. End users wouldn't know how these tools interact with each other, or these tools are unlikely designed to work in such mixed setup environment.

Do the various setting tools overwrite each other's data?

This depends on how the configuration tool works. If two different tools share same underlying configuration method i.e. GSettings, then both will supposedly read the same configuration file.

In the first screenshot, notice that Qt 4 Settings is still showing "Droid Sans (Regular)" instead of "Droid Sans (Bold)". The system wide settings in Xubuntu has changed, but the Qt 4 Settings doesn't reflect the changes immediately, possibly due to different toolkit in use. When quit and launch again, Qt 4 Settings will now show the latest font settings "Droid Sans (Bold)".

For the rest of questions, I'd suggest to look into the following linked pages for further reading.

Disclaimer: This answer is mainly based on my experience in Xubuntu 14.04 and Debian 8 Xfce (both running Xfce 4.10). Despite running a similar desktop environment, the experience was slightly different for the font settings to take effect. Known limitations are as follows.

  • Like my experience with Xfce, I would assume other systems that run a similar environment do not necessarily honour the font settings automatically.
  • I did not investigate every possible configurations of mixed environment; some discussed points may not be fully applicable to systems that are configured manually.
  • I did not test font settings for KDE applications; some KDE applications such as Dolphin file manager depends on both KDE and Qt packages, but Qt applications solely depends on Qt packages; this answer may not be relevant to KDE applications.

TL;DR Don't mix tools created for a different environment; Don't use third-party configuration tools. Use graphical tool provided by desktop environment or respective toolkits.


Answerer's note: I had written this answer to be sufficient, but not fully canonical at the time. Hence this answer is now a community wiki, so that anyone with minimum reputation can improve this post to keep up with latest changes in each toolkit, or even re-explain the font settings discrepancy using a more concise example (if done so, remove relevant text from "Disclaimer").

Related Question