Chromium Code Reviews| Index: ui/gfx/platform_font_gtk.cc |
| diff --git a/ui/gfx/platform_font_gtk.cc b/ui/gfx/platform_font_gtk.cc |
| index 5ccc7c53b3b80ee3048432d138595847ffee0afe..b04e661196a190b197c05b31a9dd9f627a4672fd 100644 |
| --- a/ui/gfx/platform_font_gtk.cc |
| +++ b/ui/gfx/platform_font_gtk.cc |
| @@ -6,14 +6,17 @@ |
| #include <algorithm> |
| #include <fontconfig/fontconfig.h> |
| +#if !defined(USE_WAYLAND) |
|
sky
2011/07/27 15:51:05
conditionals after non-conditionals.
|
| #include <gdk/gdk.h> |
| #include <gtk/gtk.h> |
| +#endif |
| #include <map> |
| #include <pango/pango.h> |
| #include "base/logging.h" |
| #include "base/string_piece.h" |
| #include "base/utf_string_conversions.h" |
| +#include "pango/pangocairo.h" |
| #include "third_party/skia/include/core/SkTypeface.h" |
| #include "third_party/skia/include/core/SkPaint.h" |
| #include "ui/gfx/canvas_skia.h" |
| @@ -56,7 +59,12 @@ PangoFontMetrics* GetPangoFontMetrics(PangoFontDescription* desc) { |
| static PangoContext* context = NULL; |
| if (!context) { |
| +#if defined(USE_WAYLAND) |
| + PangoFontMap *font_map = pango_cairo_font_map_get_default(); |
|
sky
2011/07/27 15:51:05
This looks to be the same as in gtk_util. Create a
|
| + context = pango_font_map_create_context(font_map); |
| +#else |
| context = gdk_pango_context_get_for_screen(gdk_screen_get_default()); |
| +#endif |
| pango_context_set_language(context, pango_language_get_default()); |
| } |
| @@ -120,6 +128,9 @@ Font* PlatformFontGtk::default_font_ = NULL; |
| PlatformFontGtk::PlatformFontGtk() { |
| if (default_font_ == NULL) { |
| +#if defined(USE_WAYLAND) |
|
sky
2011/07/27 15:51:05
This code is a bit hard to read. Create a function
|
| + char font_name[] = "sans 10"; |
| +#else |
| GtkSettings* settings = gtk_settings_get_default(); |
| gchar* font_name = NULL; |
| @@ -128,12 +139,16 @@ PlatformFontGtk::PlatformFontGtk() { |
| // Temporary CHECK for helping track down |
| // http://code.google.com/p/chromium/issues/detail?id=12530 |
| CHECK(font_name) << " Unable to get gtk-font-name for default font."; |
| +#endif |
| PangoFontDescription* desc = |
| pango_font_description_from_string(font_name); |
| default_font_ = new Font(desc); |
| pango_font_description_free(desc); |
| + |
| +#if !defined(USE_WAYLAND) |
| g_free(font_name); |
| +#endif |
| DCHECK(default_font_); |
| } |