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 768902 - Font too small when using gtk_widget_override_font()
Font too small when using gtk_widget_override_font()
Product: gtk+
Classification: Platform
Component: .General
Other Linux
: Normal major
: ---
Assigned To: gtk-bugs
Depends on:
Reported: 2016-07-17 13:12 UTC by Sébastien Wilmet
Modified: 2016-07-29 17:33 UTC
See Also:
GNOME target: ---
GNOME version: ---

Test with GtkEntry (579 bytes, text/plain)
2016-07-28 10:30 UTC, Sébastien Wilmet

Description Sébastien Wilmet 2016-07-17 13:12:05 UTC
There is a font size problem in GtkSourceView with GTK+ 3.21, the font size is too small.

See the 'Changes in GTK+ 3.22':

The CSS parser has gotten a bit more selective in what it accepts as valid values for the font: shorthand. Following the CSS specification, at least a size and a family name are required now. If you want to change an individual facet of the font, like the weight, use the individual CSS properties: font-weight, font-size, font-family, etc.

See also this commit:

It is maybe how CSS treats pt vs px.
Comment 1 Sébastien Wilmet 2016-07-27 08:21:38 UTC
It's actually a problem with gtk_widget_override_font(). That function is deprecated, but is still used in gedit for example.
Comment 2 Eric Williams 2016-07-27 13:45:03 UTC
This affects us in Eclipse/SWT as well, a big blocker.
Comment 3 Timm Bäder 2016-07-27 17:40:26 UTC
Can we have a testcase for this? How much smaller is it?
Comment 4 Eric Williams 2016-07-27 17:54:15 UTC
This bug is tracked upstream for us:

Our "fix" is to use CSS to set the font, but that only seems to work for the default/initial font size. Changing the font size doesn't change the size of the widget it belongs to, so the font is huge but the widget hasn't adjusted its size. This breaks all of our setFont() API.

The ideal solution would be to fix gtk_widget_override_font() so that it's working again as with GTK3.20 and below.
Comment 5 Sébastien Wilmet 2016-07-28 10:30:07 UTC
Created attachment 332269 [details]
Test with GtkEntry
Comment 6 Matthias Clasen 2016-07-28 13:12:04 UTC
Thats using gtk_widget_override_font...
Comment 7 Sébastien Wilmet 2016-07-28 15:39:50 UTC
A deprecated API is supposed to still work as intended.
Comment 8 Eric Williams 2016-07-28 16:04:35 UTC
As per discussions on IRC, Benjamin is going to commit a patch that does font size conversions properly.
Comment 9 Sébastien Wilmet 2016-07-29 17:33:54 UTC
Thanks, I confirm that the font seems to have again the good size in gedit and other text editors.