kde-gtk-config adds following code to ~/.gtkrc-2.0. style "user-font" { font_name="Oxygen-Sans Sans-Book" } widget_class "*" style "user-font" this code forces apps like Inkscape or Chrome to start ignoring fonts set by SystemSettings. As long as I comment out the "widget_class" line in the above code gtk apps starts using fonts set by SystemSettings. Reproducible: Always
Created attachment 95360 [details] side by side comparison of the problem On one side app uses some font but on the right side the same app is using default fonts set by System Settings.
Created attachment 95361 [details] buggy gtkrc-2.0 comment out following section and problem goes away. widget_class "*" style "user-font"
Could somebody check if this patch solves the issue? (and hopefully doesn't introduce regressions...?) diff --git a/src/appearancegtk2.cpp b/src/appearancegtk2.cpp index b1e0b52..6499cf8 100644 --- a/src/appearancegtk2.cpp +++ b/src/appearancegtk2.cpp @@ -119,7 +119,6 @@ bool AppearanceGTK2::saveSettings(const QString& gtkrcFile) const << "\tfont_name=\""<< fontFamily << "\"\n" << "}\n"; - flow << "widget_class \"*\" style \"user-font\"\n"; flow << "gtk-font-name=\"" << m_settings["font"] << "\"\n"; flow << "gtk-theme-name=\"" << m_settings["theme"] << "\"\n"; flow << "gtk-icon-theme-name=\""<< m_settings["icon"] << "\"\n";
Are you sure that that change does the right thing? I suspect it will make GTK+ follow the systemwide defaults, which are NOT necessarily the same as the Plasma defaults. Plasma defaults to Noto upstream and in most distros, but the systemwide default is the plain "Sans" alias, which is whatever the distro defaults to (e.g., on Fedora, "Sans" is an alias for DejaVu Sans).
Git commit a9f3a3ddcb0b197f96b750323201da438f15c4ad by Nate Graham, on behalf of Mikhail Zolotukhin. Committed on 24/08/2019 at 13:06. Pushed by ngraham into branch 'master'. Keep existing configurations' strings Summary: Gtk configurator has been replacing .gtkrc-2.0 config file with it's own settings, discarding present file contents. Now it only modifies configuration strings, or add them if they are not present at the beginning of the file. This patch also removes redundant configurations, such as including theme from /usr/share/themes gtkrc's, "user-font" style, widget_class and unneeded symlink .gtkrc-2.0-kde4. Those options do not seem needed, as gtk2 applications look the same without these options without any regressions. This was tested on Gimp, Inkscape and BleachBit apps on Manjaro, OpenSUSE and KDE Neon distributions. As for gtk3 ini file - this is not reproducible anymore, any line, which does not hold parameter changeable in configurator, remains in settings.ini. Related: bug 322797, bug 342320 FIXED-IN: 5.17.0 Test Plan: Insert some lines in .gtkrc-2.0 file, that do not represent settings, that configurator changes, check if they are still present after applying new settings. Check if gtk2 apps look identical with or without .gtkrc-2.0-kde4 symlink, with or without similar lines in .gtrkrc-2.0: ``` include "/usr/share/themes/Breeze/gtk-2.0/gtkrc" style "user-font" { font_name="Noto Sans Regular" } widget_class "*" style "user-font" ``` Reviewers: apol, #plasma Reviewed By: apol Subscribers: GB_2, ngraham, plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D21524 M +52 -51 src/appearancegtk2.cpp M +2 -0 src/appearancegtk2.h https://commits.kde.org/kde-gtk-config/a9f3a3ddcb0b197f96b750323201da438f15c4ad
This needs to be tested on a distro such as Fedora where the default Sans alias, the default Plasma font, and the default GNOME font are all different. (On Fedora, those are DejaVu Sans, Noto Sans, and Cantarell, respectively.)