OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/gfx/platform_font_gtk.h" | 5 #include "ui/gfx/platform_font_gtk.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <fontconfig/fontconfig.h> | 8 #include <fontconfig/fontconfig.h> |
9 #include <map> | 9 #include <map> |
10 #include <pango/pango.h> | 10 #include <pango/pango.h> |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 FcPatternGetString(match, FC_FAMILY, 0, &match_family); | 107 FcPatternGetString(match, FC_FAMILY, 0, &match_family); |
108 | 108 |
109 string16 font_family = UTF8ToUTF16(reinterpret_cast<char*>(match_family)); | 109 string16 font_family = UTF8ToUTF16(reinterpret_cast<char*>(match_family)); |
110 FcPatternDestroy(match); | 110 FcPatternDestroy(match); |
111 FcPatternDestroy(pattern); | 111 FcPatternDestroy(pattern); |
112 free(family_name_copy); | 112 free(family_name_copy); |
113 return font_family; | 113 return font_family; |
114 } | 114 } |
115 | 115 |
116 std::string GetDefaultFont() { | 116 std::string GetDefaultFont() { |
117 #if defined(USE_WAYLAND) | 117 #if defined(USE_WAYLAND) || defined(USE_AURA) |
118 return "sans 10"; | 118 return "sans 10"; |
119 #else | 119 #else |
120 GtkSettings* settings = gtk_settings_get_default(); | 120 GtkSettings* settings = gtk_settings_get_default(); |
121 | 121 |
122 gchar* font_name = NULL; | 122 gchar* font_name = NULL; |
123 g_object_get(settings, "gtk-font-name", &font_name, NULL); | 123 g_object_get(settings, "gtk-font-name", &font_name, NULL); |
124 | 124 |
125 // Temporary CHECK for helping track down | 125 // Temporary CHECK for helping track down |
126 // http://code.google.com/p/chromium/issues/detail?id=12530 | 126 // http://code.google.com/p/chromium/issues/detail?id=12530 |
127 CHECK(font_name) << " Unable to get gtk-font-name for default font."; | 127 CHECK(font_name) << " Unable to get gtk-font-name for default font."; |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 return new PlatformFontGtk(native_font); | 462 return new PlatformFontGtk(native_font); |
463 } | 463 } |
464 | 464 |
465 // static | 465 // static |
466 PlatformFont* PlatformFont::CreateFromNameAndSize(const string16& font_name, | 466 PlatformFont* PlatformFont::CreateFromNameAndSize(const string16& font_name, |
467 int font_size) { | 467 int font_size) { |
468 return new PlatformFontGtk(font_name, font_size); | 468 return new PlatformFontGtk(font_name, font_size); |
469 } | 469 } |
470 | 470 |
471 } // namespace gfx | 471 } // namespace gfx |
OLD | NEW |