After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 758367 - GTK+ 3 does not respect bold in org.gnome.desktop.interface font-name
GTK+ 3 does not respect bold in org.gnome.desktop.interface font-name
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Themes
3.18.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2015-11-19 20:18 UTC by Hugo Holgersson
Modified: 2015-11-23 13:22 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Hugo Holgersson 2015-11-19 20:18:12 UTC
Reproduction steps
----------------
1. Open "dconf-editor" and set org.gnome.desktop.interface font-name
to "DejaVu Sans Mono Bold 10". (Using gnome-tweak-tool works as well.)
2. Notice that gtk_label_new("any text") is NON-bold.

Expected behavior
----------------
GTK apps respect the users' font-setting, even when it is a bold font.

This is a degrade from GTK+2 to GTK+3. It is easy to see when compiling Wikipedia's "hello world" exampl, 
https://en.wikipedia.org/wiki/GTK%2B#Example

# Correct. Shows bold fonts.
$ cc -Wall helloworld.c -o helloworld $(pkg-config --cflags --libs gtk+-2.0)

# Wrong. Does not show bold fonts.
$ cc -Wall helloworld.c -o helloworld $(pkg-config --cflags --libs gtk+-3.0)

More information
----------------
I first saw this on Fedora 22 and Ubuntu 14.04, but the problem is also in
today's origin/gtk-3-18 (bd3ea2355bee3ff51647131bf2294afd245dd5a) and origin/master (0434649cc14f1e860dca6ff14a2d3ce3aec68ac4).

Workaround (proofs that GTK is indeed requesting the non-bold font):
----------------
Add this to your .fonts.conf

 <match target="pattern">
  <test compare="eq" name="family" qual="any">
   <string>DejaVu Sans Mono</string>
  </test>
  <edit binding="same" mode="prepend" name="weight">
   <const>bold</const>
  </edit>
 </match>
Comment 1 Matthias Clasen 2015-11-20 12:43:15 UTC
GTK+ only takes the family name and the size from the font setting. This is in line with what CSS does.