Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(572)

Unified Diff: ui/gfx/pango_util.cc

Issue 9296042: aura: Make Linux UI text rendering match GTK Chrome OS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/pango_util.cc
diff --git a/ui/gfx/pango_util.cc b/ui/gfx/pango_util.cc
index 060023748b58b56b84adbda722033b4a3a14dd24..6ef67205b0acc033fc4985e70b1b5f07fed776f5 100644
--- a/ui/gfx/pango_util.cc
+++ b/ui/gfx/pango_util.cc
@@ -36,8 +36,7 @@ const double kFadeWidthFactor = 1.5;
// End state of the elliding fade.
const double kFadeFinalAlpha = 0.15;
-// Return |cairo_font_options|. If needed, allocate and update it based on
-// GtkSettings.
+// Return |cairo_font_options|. If needed, allocate and update it.
cairo_font_options_t* GetCairoFontOptions() {
// Font settings that we initialize once and then use when drawing text.
static cairo_font_options_t* cairo_font_options = NULL;
@@ -47,13 +46,12 @@ cairo_font_options_t* GetCairoFontOptions() {
cairo_font_options = cairo_font_options_create();
+#if defined(TOOLKIT_USES_GTK)
gint antialias = 0;
gint hinting = 0;
gchar* hint_style = NULL;
gchar* rgba_style = NULL;
-#if !defined(USE_WAYLAND) && defined(TOOLKIT_USES_GTK)
- // TODO(xji): still has gtk dependency.
GtkSettings* gtk_settings = gtk_settings_get_default();
g_object_get(gtk_settings,
"gtk-xft-antialias", &antialias,
@@ -61,7 +59,6 @@ cairo_font_options_t* GetCairoFontOptions() {
"gtk-xft-hintstyle", &hint_style,
"gtk-xft-rgba", &rgba_style,
NULL);
-#endif
// g_object_get() doesn't tell us whether the properties were present or not,
// but if they aren't (because gnome-settings-daemon isn't running), we'll get
@@ -108,6 +105,17 @@ cairo_font_options_t* GetCairoFontOptions() {
g_free(hint_style);
if (rgba_style)
g_free(rgba_style);
+#else
+ // For non-GTK builds (read: Aura), use the same settings that were previously
+ // used for GTK Chrome OS builds: RGB subpixel rendering with strong hinting.
+ // Note: We should probably be getting per-font settings from FontConfig here,
+ // but this path will be made obsolete by http://crbug.com/105550.
+ cairo_font_options_set_antialias(cairo_font_options,
+ CAIRO_ANTIALIAS_SUBPIXEL);
+ cairo_font_options_set_subpixel_order(cairo_font_options,
+ CAIRO_SUBPIXEL_ORDER_RGB);
+ cairo_font_options_set_hint_style(cairo_font_options, CAIRO_HINT_STYLE_FULL);
+#endif
return cairo_font_options;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698