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
1=== modified file 'src/PlacesSimpleTile.cpp'
2--- src/PlacesSimpleTile.cpp 2011-03-16 21:54:33 +0000
3+++ src/PlacesSimpleTile.cpp 2011-03-21 10:26:26 +0000
4@@ -28,7 +28,7 @@
5
6 #include <NuxImage/GdkGraphics.h>
7 #include <gtk/gtk.h>
8-
9+#include <gdk/gdk.h>
10
11 PlacesSimpleTile::PlacesSimpleTile (const char *icon_name,
12 const char *label,
13@@ -40,6 +40,10 @@
14 _icon (NULL),
15 _uri (NULL)
16 {
17+ GtkSettings *settings = gtk_settings_get_default ();
18+ gchar *font = NULL;
19+ gchar *fontstring = NULL;
20+
21 nux::VLayout *layout = new nux::VLayout ("", NUX_TRACKER_LOCATION);
22
23 _label = g_strdup (label);
24@@ -52,7 +56,11 @@
25
26 _cairotext = new nux::StaticCairoText (_label);
27 _cairotext->SinkReference ();
28- _cairotext->SetFont ("Ubuntu normal 9");
29+
30+ g_object_get (settings, "gtk-font-name", &font, NULL);
31+ fontstring = g_strdup_printf ("%s normal 10", font);
32+
33+ _cairotext->SetFont (fontstring);
34 _cairotext->SetTextEllipsize (nux::StaticCairoText::NUX_ELLIPSIZE_START);
35 _cairotext->SetTextAlignment (nux::StaticCairoText::NUX_ALIGN_CENTRE);
36 _cairotext->SetMaximumWidth (140);
37@@ -67,6 +75,9 @@
38 SetLayout (layout);
39
40 SetDndEnabled (true, false);
41+
42+ g_free (font);
43+ g_free (fontstring);
44 }
45
46
47
48=== modified file 'src/StaticCairoText.cpp'
49--- src/StaticCairoText.cpp 2011-03-10 12:42:07 +0000
50+++ src/StaticCairoText.cpp 2011-03-21 10:26:26 +0000
51@@ -414,9 +414,15 @@
52 (float) dpi / (float) PANGO_SCALE);
53 }
54
55- cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
56- cairo_set_source_rgba (cr, 0.0f, 0.0f, 0.0f, 0.0f);
57+ //cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
58+
59+ cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
60 cairo_paint (cr);
61+
62+
63+ cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
64+ //cairo_set_source_rgba (cr, 0.0f, 0.0f, 0.0f, 0.0f);
65+ //cairo_paint (cr);
66 cairo_set_source_rgba (cr, color.R (),color.G (), color.B (), color.A ());
67
68 pango_layout_context_changed (layout);