Merge lp:~gordallott/unity/places-subpix-rendering into lp:unity

Proposed by Gord Allott
Status: Merged
Approved by: Didier Roche-Tolomelli
Approved revision: no longer in the source branch.
Merged at revision: 994
Proposed branch: lp:~gordallott/unity/places-subpix-rendering
Merge into: lp:unity
Diff against target: 68 lines (+21/-4)
2 files modified
src/PlacesSimpleTile.cpp (+13/-2)
src/StaticCairoText.cpp (+8/-2)
To merge this branch: bzr merge lp:~gordallott/unity/places-subpix-rendering
Reviewer Review Type Date Requested Status
Didier Roche-Tolomelli Approve
Review via email: mp+54178@code.launchpad.net

Description of the change

enables subpixel rendering in places text, also increases the font size by one point, mainly just because the font provides thicker text there which is much more appealing

To post a comment you must log in.
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

approved!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/PlacesSimpleTile.cpp'
--- src/PlacesSimpleTile.cpp 2011-03-16 21:54:33 +0000
+++ src/PlacesSimpleTile.cpp 2011-03-21 10:26:26 +0000
@@ -28,7 +28,7 @@
2828
29#include <NuxImage/GdkGraphics.h>29#include <NuxImage/GdkGraphics.h>
30#include <gtk/gtk.h>30#include <gtk/gtk.h>
3131#include <gdk/gdk.h>
3232
33PlacesSimpleTile::PlacesSimpleTile (const char *icon_name,33PlacesSimpleTile::PlacesSimpleTile (const char *icon_name,
34 const char *label,34 const char *label,
@@ -40,6 +40,10 @@
40 _icon (NULL),40 _icon (NULL),
41 _uri (NULL)41 _uri (NULL)
42{42{
43 GtkSettings *settings = gtk_settings_get_default ();
44 gchar *font = NULL;
45 gchar *fontstring = NULL;
46
43 nux::VLayout *layout = new nux::VLayout ("", NUX_TRACKER_LOCATION);47 nux::VLayout *layout = new nux::VLayout ("", NUX_TRACKER_LOCATION);
4448
45 _label = g_strdup (label);49 _label = g_strdup (label);
@@ -52,7 +56,11 @@
5256
53 _cairotext = new nux::StaticCairoText (_label);57 _cairotext = new nux::StaticCairoText (_label);
54 _cairotext->SinkReference ();58 _cairotext->SinkReference ();
55 _cairotext->SetFont ("Ubuntu normal 9");59
60 g_object_get (settings, "gtk-font-name", &font, NULL);
61 fontstring = g_strdup_printf ("%s normal 10", font);
62
63 _cairotext->SetFont (fontstring);
56 _cairotext->SetTextEllipsize (nux::StaticCairoText::NUX_ELLIPSIZE_START);64 _cairotext->SetTextEllipsize (nux::StaticCairoText::NUX_ELLIPSIZE_START);
57 _cairotext->SetTextAlignment (nux::StaticCairoText::NUX_ALIGN_CENTRE);65 _cairotext->SetTextAlignment (nux::StaticCairoText::NUX_ALIGN_CENTRE);
58 _cairotext->SetMaximumWidth (140);66 _cairotext->SetMaximumWidth (140);
@@ -67,6 +75,9 @@
67 SetLayout (layout);75 SetLayout (layout);
6876
69 SetDndEnabled (true, false);77 SetDndEnabled (true, false);
78
79 g_free (font);
80 g_free (fontstring);
70}81}
7182
7283
7384
=== modified file 'src/StaticCairoText.cpp'
--- src/StaticCairoText.cpp 2011-03-10 12:42:07 +0000
+++ src/StaticCairoText.cpp 2011-03-21 10:26:26 +0000
@@ -414,9 +414,15 @@
414 (float) dpi / (float) PANGO_SCALE);414 (float) dpi / (float) PANGO_SCALE);
415 }415 }
416416
417 cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);417 //cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
418 cairo_set_source_rgba (cr, 0.0f, 0.0f, 0.0f, 0.0f);418
419 cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
419 cairo_paint (cr);420 cairo_paint (cr);
421
422
423 cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
424 //cairo_set_source_rgba (cr, 0.0f, 0.0f, 0.0f, 0.0f);
425 //cairo_paint (cr);
420 cairo_set_source_rgba (cr, color.R (),color.G (), color.B (), color.A ());426 cairo_set_source_rgba (cr, color.R (),color.G (), color.B (), color.A ());
421427
422 pango_layout_context_changed (layout);428 pango_layout_context_changed (layout);