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 652709 - Search results do not respect font settings
Search results do not respect font settings
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: shell
3.0.x
Other Linux
: Normal normal
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-06-16 10:14 UTC by Stefano Facchini
Modified: 2011-06-21 14:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Control center main shell (63.07 KB, image/png)
2011-06-16 10:15 UTC, Stefano Facchini
  Details
Control center search results (85.03 KB, image/png)
2011-06-16 10:15 UTC, Stefano Facchini
  Details
Fix the font rendering in control center search results (1.27 KB, patch)
2011-06-17 20:50 UTC, Stefano Facchini
none Details | Review
Fix the font rendering in control center search results (1.77 KB, patch)
2011-06-18 10:08 UTC, Stefano Facchini
none Details | Review

Description Stefano Facchini 2011-06-16 10:14:40 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).
Comment 1 Stefano Facchini 2011-06-16 10:15:24 UTC
Created attachment 190023 [details]
Control center main shell
Comment 2 Stefano Facchini 2011-06-16 10:15:52 UTC
Created attachment 190024 [details]
Control center search results
Comment 3 Bastien Nocera 2011-06-17 10:24:20 UTC
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.
Comment 4 Matthias Clasen 2011-06-17 11:41:21 UTC
Sounds plausible. Not sure there is any bug here.
Comment 5 Stefano Facchini 2011-06-17 11:50:16 UTC
(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...
Comment 6 Matthias Clasen 2011-06-17 18:35:04 UTC
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.
Comment 7 Stefano Facchini 2011-06-17 20:50:39 UTC
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.
Comment 8 Stefano Facchini 2011-06-18 10:08:25 UTC
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.
Comment 9 Bastien Nocera 2011-06-21 14:12:06 UTC
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