GNOME Bugzilla – Bug 599713
follow system font hinting style
Last modified: 2010-05-03 22:59:42 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.
*** Bug 603890 has been marked as a duplicate of this bug. ***
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)
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.
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.
(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.
Created attachment 156344 [details] [review] Pick up system settings for font rendering Use GtkSettings instead of GConf, set up resolution as well.
*** Bug 614074 has been marked as a duplicate of this bug. ***
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.
Attachment 156344 [details] pushed as b0ba40f - Pick up system settings for font rendering