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

Side by Side Diff: ui/gfx/platform_font_pango.cc

Issue 9111042: Fix RTL and complex script title in print preview header/footer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use RenderText instead Created 8 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_pango.h" 5 #include "ui/gfx/platform_font_pango.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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // pango_font_description_from_string()) for the default UI font. 94 // pango_font_description_from_string()) for the default UI font.
95 std::string GetDefaultFont() { 95 std::string GetDefaultFont() {
96 #if defined(USE_WAYLAND) || !defined(TOOLKIT_USES_GTK) 96 #if defined(USE_WAYLAND) || !defined(TOOLKIT_USES_GTK)
97 #if defined(OS_CHROMEOS) 97 #if defined(OS_CHROMEOS)
98 return l10n_util::GetStringUTF8(IDS_UI_FONT_FAMILY_CROS); 98 return l10n_util::GetStringUTF8(IDS_UI_FONT_FAMILY_CROS);
99 #else 99 #else
100 return "sans 10"; 100 return "sans 10";
101 #endif // defined(OS_CHROMEOS) 101 #endif // defined(OS_CHROMEOS)
102 #else 102 #else
103 GtkSettings* settings = gtk_settings_get_default(); 103 GtkSettings* settings = gtk_settings_get_default();
104 if (settings == NULL) { // Probably caused by sandbox, give a default.
105 return "sans 10";
106 }
104 107
105 gchar* font_name = NULL; 108 gchar* font_name = NULL;
106 g_object_get(settings, "gtk-font-name", &font_name, NULL); 109 g_object_get(settings, "gtk-font-name", &font_name, NULL);
107 110
108 // Temporary CHECK for helping track down 111 // Temporary CHECK for helping track down
109 // http://code.google.com/p/chromium/issues/detail?id=12530 112 // http://code.google.com/p/chromium/issues/detail?id=12530
110 CHECK(font_name) << " Unable to get gtk-font-name for default font."; 113 CHECK(font_name) << " Unable to get gtk-font-name for default font.";
111 114
112 std::string default_font = std::string(font_name); 115 std::string default_font = std::string(font_name);
113 g_free(font_name); 116 g_free(font_name);
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 return new PlatformFontPango(native_font); 429 return new PlatformFontPango(native_font);
427 } 430 }
428 431
429 // static 432 // static
430 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, 433 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name,
431 int font_size) { 434 int font_size) {
432 return new PlatformFontPango(font_name, font_size); 435 return new PlatformFontPango(font_name, font_size);
433 } 436 }
434 437
435 } // namespace gfx 438 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698