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 599713 - follow system font hinting style
follow system font hinting style
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
: 603890 614074 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-10-26 23:11 UTC by William Jon McCann
Modified: 2010-05-03 22:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Pick up system settings for font rendering (6.75 KB, patch)
2010-03-12 00:43 UTC, Florian Müllner
reviewed Details | Review
Pick up system settings for font rendering (7.65 KB, patch)
2010-03-17 10:17 UTC, Florian Müllner
committed Details | Review

Description William Jon McCann 2009-10-26 23:11:37 UTC
Owen mentioned that the shell probably doesn't follow the system font hinting style and it should.  If one wants to change the style now they'd have to:
--- a/src/gnome-shell-plugin.c
+++ b/src/gnome-shell-plugin.c
@@ -176,6 +176,7 @@ gnome_shell_plugin_constructed (GObject *object)
    * generating them then squashing them back to A8 is pointless.
    */
   cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY);
+  cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_SLIGHT);
   clutter_backend_set_font_options (backend, font_options);
   cairo_font_options_destroy (font_options);

But he said instead of that it should just pick up what is configured.
Comment 1 Owen Taylor 2009-12-07 17:21:41 UTC
*** Bug 603890 has been marked as a duplicate of this bug. ***
Comment 2 Owen Taylor 2009-12-07 17:23:04 UTC
bug 603890 points out resolutiona as well (and font sizes from the font capplet, but I'm less sure that we want to pick that up - depends a bit on what we do for the font capplet)
Comment 3 Florian Müllner 2010-03-12 00:43:40 UTC
Created attachment 155907 [details] [review]
Pick up system settings for font rendering

The appearance capplet has a tab for font settings, which we currently
ignore - pick up the settings for antialiasing and hint style.
Comment 4 Owen Taylor 2010-03-15 16:46:45 UTC
Review of attachment 155907 [details] [review]:

The thing that is missing here is resolution - it doesn't matter much for now, since all our font sizes and other sizes are in 'px', but we want to move away from that long term, so we should be hooking up st_theme_context_set_resolution() to the same resolution that GTK+ is using.

There are two possibilities for that:

 * Do it in the gnome-shell then call st_theme_context_get_for_stage() to get the theme context.

 * Make ST do the hookup itself internally by using GTK+ APIs.

Let's go with the former to keep things simple. The tricky thing about resolution is that the mapping from GConf to the used resolution is not straightforward. What gnome-settings daemon does is:

        value = gconf_client_get_without_default (client, FONT_DPI_KEY, NULL);

        /* If the user has ever set the DPI preference in GConf, we use that.
         * Otherwise, we see if the X server reports a reasonable DPI value:  some X
         * servers report completely bogus values, and the user gets huge or tiny
         * fonts which are unusable.
         */

        if (value != NULL) {
                dpi = gconf_value_get_float (value);
                gconf_value_free (value);
        } else {
                dpi = get_dpi_from_x_server ();
        }

[ I really dislike this, but that's beside the point ... we shouldn't deviate from the rest of the desktop. ]

One possibility to pick this logic up automatically (and pick it up automatically if it ever gets fixed) is to switch to using GtkSettings instead of GConf (see gtk+/gtk/gtksettings.c:settings_update_font_options()). I think that might be the best way to go, though you'll need a fallback if the resolution isn't set in GtkSettings, but I think just using a fixed resolution of 96. would be fine for that.

The other alternative is to duplicate the above code from gnome-settings-daemon in our code.

::: src/gnome-shell-plugin.c
@@ +174,3 @@
+  g_signal_connect (client,
+                    "value-changed",
+                    G_CALLBACK (gnome_shell_plugin_update_font_options),

Doesn't matter if we switch to GtkSettings, but I don't see how this gets called initially.
Comment 5 Florian Müllner 2010-03-15 17:22:21 UTC
(In reply to comment #4)
> Doesn't matter if we switch to GtkSettings, but I don't see how this gets
> called initially.

IMO it's one of the idiosyncrasies of GConf, but the signal is indeed emitted on initialization.
Comment 6 Florian Müllner 2010-03-17 10:17:05 UTC
Created attachment 156344 [details] [review]
Pick up system settings for font rendering

Use GtkSettings instead of GConf, set up resolution as well.
Comment 7 Owen Taylor 2010-03-27 16:32:56 UTC
*** Bug 614074 has been marked as a duplicate of this bug. ***
Comment 8 Owen Taylor 2010-05-03 22:13:28 UTC
Review of attachment 156344 [details] [review]:

This looks great, just two minor style comments

(At some point we need to go in and stop using px somewhere - or picking up DPI doesn't do much good. I had to open LG to test that it was working at all.)

::: src/gnome-shell-plugin.c
@@ +216,3 @@
    */
+  antialias_mode = antialias ? CAIRO_ANTIALIAS_GRAY
+                             : CAIRO_ANTIALIAS_NONE;

This produces the right effect, but it is confusing. I think it would be better as

 (antialias < 0 || antialias) ? CAIRO_ANTIALIAS_GRAY
                              : CAIRO_ANTIALIAS_NONE;

[ Unless GCC complains about that or something ] - the point is that antialias < 0 is the default and not a boolean value.

@@ +225,3 @@
+
+static void
+settings_notify_cb (GtkSettings *settings, GParamSpec *pspec, gpointer data)

Parameters go on separate lines.
Comment 9 Florian Müllner 2010-05-03 22:59:38 UTC
Attachment 156344 [details] pushed as b0ba40f - Pick up system settings for font rendering