GNOME Bugzilla – Bug 652709
Search results do not respect font settings
Last modified: 2011-06-21 14:12:06 UTC
It seems that fonts in search results are rendered differently than the rest of the UI (not antialiased, see attachments). I have installed freetype with infinality patch and all other applications respect it (even gnome-control-center main shell).
Created attachment 190023 [details] Control center main shell
Created attachment 190024 [details] Control center search results
The search results are displayed using the "<small>" attribute in GTK+. No custom code here. The anti-aliasing is most likely disabled below a certain size, otherwise it makes it unreadable.
Sounds plausible. Not sure there is any bug here.
(In reply to comment #3) > The search results are displayed using the "<small>" attribute in GTK+. No > custom code here. The anti-aliasing is most likely disabled below a certain > size, otherwise it makes it unreadable. Mmhh, I tried to apply the following patch --- a/shell/shell-search-renderer.c +++ b/shell/shell-search-renderer.c @@ -184,7 +184,7 @@ shell_search_renderer_set_layout (ShellSearchRenderer *cell, GtkWidget *widget) lead = g_strndup (lead, start - lead); display_string = g_markup_printf_escaped ("%s\n" - "<small>%s%s<b>%s</b>%s</small>", + "%s%s<b>%s</b>%s", priv->title, leaddot, lead, match, trail); and in fact the text is rendered with the same size as the main shell window, but the problem persist! Moreover, I have other GTK applications using small fonts without any issue. There must be something non standard in the search window, because it looks as if it were badly "rasterized", instead of properly using freetype...
Oh, so this may after all come down to a difference in code: Normally, GTK+ uses pango_cairo_show_layout (cr, layout); to render text (eg in GtkLabel). But the cell renderer used in the search view (shell-search-renderer.c) uses /* FIXME: get the correct colour from the theme */ cairo_set_source_rgb (cr, 0, 0, 0); if (priv->layout) pango_cairo_layout_path (cr, priv->layout); cairo_fill (cr); which, I believe, looses any font smartness in rendering, and just treats the text as a path to fill.
Created attachment 190157 [details] [review] Fix the font rendering in control center search results Following Matthias suggestion, this patch fixes the font rendering. I also tried to fix the color rendering, not sure if this is the correct solution.
Created attachment 190169 [details] [review] Fix the font rendering in control center search results Moved the code which retrieves the text color to the search renderer init function. In this way it is executed only once at startup.
commit c81c08c299e7f7dedbded404ec86b825feb8cba7 Author: Bastien Nocera <hadess@hadess.net> Date: Tue Jun 21 15:10:08 2011 +0100 shell: Fix bad rendering of search results Don't use pango_cairo_layout_path(), which doesn't do any hinting whatsoever, use gtk_render_layout() from GTK+ instead, as the text cell renderer already does. With help from Matthias Clasen <mclasen@redhat.com> https://bugzilla.gnome.org/show_bug.cgi?id=652709