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 774248 - Desktop-wide text scaling factor is ignored by gtk_widget_override_font() (GTK+ 3.22 regression)
Desktop-wide text scaling factor is ignored by gtk_widget_override_font() (GT...
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
3.22.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
: 771898 782526 784271 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2016-11-11 08:53 UTC by Fabio Valentini
Modified: 2018-02-05 17:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test case that calls gtk_widget_override_font() (699 bytes, text/plain)
2016-11-27 10:31 UTC, Sébastien Wilmet
  Details
css: Add a workaround for gtk_widget_override_font() (1.78 KB, patch)
2017-11-14 03:10 UTC, Benjamin Otte (Company)
committed Details | Review

Description Fabio Valentini 2016-11-11 08:53:43 UTC
Since GNOME 3.22 the GtkSourceView widget (as used in gedit, gnome-builder, etc.) ignores the text scaling factor set in the "org.gnome.desktop.interface.text-scaling-factor" gsettings key.

As a result, all text is scaled properly, except in the GtkSourceView widget, which is much too big (in my case). Setting the font size to something like 8pt manually is not really acceptable, because that also affects gnome-terminal (which scales fonts correctly).
Comment 1 Sébastien Wilmet 2016-11-12 15:33:23 UTC
*** Bug 771898 has been marked as a duplicate of this bug. ***
Comment 2 Sébastien Wilmet 2016-11-12 15:37:20 UTC
Moving to GTK+, because GtkSourceView didn't deal with this, and it is useful for all GtkTextView widgets, not just GtkSourceView.
Comment 3 Matthias Clasen 2016-11-12 21:01:33 UTC
Not seeing that here, with gtk3-demo, you will have to give a concrete example where you see it failing.
Comment 4 Sébastien Wilmet 2016-11-13 11:08:55 UTC
(In reply to Fabio Valentini from comment #0)
> Since GNOME 3.22 the GtkSourceView widget (as used in gedit, gnome-builder,
> etc.) ignores the text scaling factor set in the
> "org.gnome.desktop.interface.text-scaling-factor" gsettings key.

I supposed that that sentence was true and concluded that it's a gtk bug since GtkSourceView doesn't deal with the text-scaling-factor.

But after testing myself, gtk3-demo works fine and gtksourceview's various tests work fine too. So the problem is in gedit and gnome-builder.
Comment 5 Fabio Valentini 2016-11-13 13:01:16 UTC
I am sorry about the confusion - but the gnome-builder behavior seems to have changed (to the correct one) since I originally reported this bug in the fedora bugzilla about a month ago (so I was wrong about the source of the problem, sorry about that).

Now, the only applications I can find where the text doesn't scale correctly are "gedit" and "scratch" (the elementary text editor).
Comment 6 Poncho 2016-11-13 14:12:34 UTC
(In reply to Fabio Valentini from comment #5)
> Now, the only applications I can find where the text doesn't scale correctly
> are "gedit" and "scratch" (the elementary text editor).

For me it's gedit and meld (http://meldmerge.org/)
Comment 7 Atri 2016-11-13 22:03:19 UTC
Also seen on anjuta 3.22.0, new mail composer in evolution 3.22.2, meld 3.16.3, latexila 3.22.0 so far.

System info: openSUSE Tumbleweed, GNOME 3.22.2
Comment 8 Adam Williamson 2016-11-16 21:48:19 UTC
I'm seeing this in gedit and the evolution composer (I filed https://bugzilla.gnome.org/show_bug.cgi?id=774596 on that) on my laptop after upgrade from Fedora 24 to Fedora 25 (and switch to Wayland).
Comment 9 Adam Williamson 2016-11-16 21:48:38 UTC
*** Bug 774596 has been marked as a duplicate of this bug. ***
Comment 10 Sébastien Wilmet 2016-11-19 13:51:16 UTC
I suspect that the bug comes from the use of gtk_widget_override_font(). It's a deprecated function. (But even for deprecated functions, regressions should be fixed).
Comment 11 Poncho 2016-11-24 12:16:07 UTC
(In reply to Sébastien Wilmet from comment #10)
> I suspect that the bug comes from the use of gtk_widget_override_font().
> It's a deprecated function. (But even for deprecated functions, regressions
> should be fixed).

after reverting:

css: Fix case where we didn't convert pt => px
https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-22&id=5ccc0e40f5eaa9c0e2121674913c398e9963f0be

text size is more what I would expect with a scaling factor of 0.8
Comment 12 Sébastien Wilmet 2016-11-27 10:30:09 UTC
Moving to GTK+, I'll attach a small test case. The bug occurs if gtk_widget_override_font() is called.
Comment 13 Sébastien Wilmet 2016-11-27 10:31:08 UTC
Created attachment 340837 [details]
Test case that calls gtk_widget_override_font()
Comment 14 Adam Williamson 2016-11-28 18:50:22 UTC
Documented for F25 at https://fedoraproject.org/wiki/Common_F25_bugs#wayland-hidpi-gedit-evo .
Comment 15 Jürg Billeter 2016-11-28 18:55:37 UTC
(In reply to Adam Williamson from comment #14)
> Documented for F25 at
> https://fedoraproject.org/wiki/Common_F25_bugs#wayland-hidpi-gedit-evo .

Please note that this is not a Wayland-specific issue. I see it here on X11.
Comment 16 Fabio Valentini 2016-11-28 18:59:26 UTC
Absolutely, this problem is independent of wayland - I am running gnome on Xorg atop NVIDIA drivers, so definitely no wayland involved ...
Comment 17 Adam Williamson 2016-11-28 19:23:33 UTC
huh, thanks, I'll correct that. guess I didn't actually try X on my affected system.
Comment 18 Michael Catanzaro 2016-11-28 21:11:05 UTC
(In reply to Adam Williamson from comment #14)
> Documented for F25 at
> https://fedoraproject.org/wiki/Common_F25_bugs#wayland-hidpi-gedit-evo .

I bet Evolution and gedit are actually different bugs with the same symptom. WebKit requires applications compute text size manually based on the size of the monitor and pixel density. I wish I were kidding, but we just copy/paste the same 100 lines of code to do this among a bunch of different GNOME apps; each new app that uses WebKit doesn't know to do this and is broken until we figure it out, and it's easier to copy/paste than spend a day fixing WebKit and writing layout tests for it. You might want to file an Evolution bug pointing at https://bugs.webkit.org/show_bug.cgi?id=142673#c6
Comment 19 Adam Williamson 2016-11-28 21:25:24 UTC
I guess. It *used* to work with Evo, though, and then suddenly stopped working on upgrade to F25. Just like gedit.
Comment 20 Michael Catanzaro 2016-11-28 23:41:48 UTC
Remember F24->F25 means Evo has switched to WK2
Comment 21 Adam Williamson 2016-11-29 00:43:45 UTC
Fair enough. I guess I'll re-open my 'dupe', then.
Comment 22 Atri 2017-03-07 02:57:08 UTC
With 3.23.91, only the problems with gedit, anjuta, latexila remain. evo is fine now, so is builder (from my not-so-rigorous testing). Couldn't test meld yet.
Comment 23 Piotr Drąg 2017-06-28 00:41:44 UTC
*** Bug 784271 has been marked as a duplicate of this bug. ***
Comment 24 Piotr Drąg 2017-06-28 00:44:49 UTC
*** Bug 782526 has been marked as a duplicate of this bug. ***
Comment 25 Till Kamppeter 2017-06-28 02:14:48 UTC
Also reported at Ubuntu as

https://bugs.launchpad.net/gedit/+bug/1700092
Comment 26 Michael Catanzaro 2017-06-28 03:45:39 UTC
Hey Company, looks like this is a regression from one of your commits, see starting at comment #10
Comment 27 Adam Williamson 2017-11-14 01:10:01 UTC
ping?
Comment 28 Benjamin Otte (Company) 2017-11-14 03:10:23 UTC
Created attachment 363551 [details] [review]
css: Add a workaround for gtk_widget_override_font()

The problem here is that the CSS machinery expects font sizes to be in
pixels, but gtk_widget_override_font() provides a value in point and the
CSS machinery has no ability to query the DPI and convert.

This patch changes the dconversion DPI we use from a hardcoded 96 to the
default screen's DPI, which should work better than before.
This will of course not listen to changes in the default screen's DPI,
but that shouldn't be a problem.

People who want to workaround this should use gtk_widget_override_font()
with a font that has an absolute size set via
pango_font_description_set_absolute_size (size * PANGO_SCALE *
                                          gdk_screen_get_resolution (screen));
Comment 29 Benjamin Otte (Company) 2017-11-14 03:14:39 UTC
Does this patch work better?

It's a problem resulting from a cleanup we did to unify the handling of font sizes in GTK to fix various issues and we had to judge what the best place was to hide the fallout and we chose gtk_widget_override_font().

The fix mentioned in the patch of using pango_font_description_set_absolute_size() might be a useful workaround for GtkSourceView (Assuming it works as I think it should, I did not test it right now).
Comment 30 Sébastien Wilmet 2017-11-16 16:31:48 UTC
The "org.gnome.desktop.interface.text-scaling-factor" gsettings key apparently doesn't work on Xfce, but maybe the patch works fine on GNOME, I haven't tested on GNOME.
Comment 31 Benjamin Otte (Company) 2018-02-05 17:59:41 UTC
Attachment 363551 [details] pushed as 6ff326a - css: Add a workaround for gtk_widget_override_font()