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

Unified Diff: ui/gfx/platform_font_pango.cc

Issue 374833005: Simplify PangoLayout configuration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove unneeded PangoContext forward declaration Created 6 years, 5 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 | « ui/gfx/platform_font_pango.h ('k') | ui/gfx/render_text_pango.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/platform_font_pango.cc
diff --git a/ui/gfx/platform_font_pango.cc b/ui/gfx/platform_font_pango.cc
index 9954ecdc05710d5524475411bdfdf1c918ce05b2..2120d3311bfdbc0ba7df7d6c4f4de38e3f0abc24 100644
--- a/ui/gfx/platform_font_pango.cc
+++ b/ui/gfx/platform_font_pango.cc
@@ -73,14 +73,20 @@ std::string* PlatformFontPango::default_font_description_ = NULL;
// PlatformFontPango, public:
PlatformFontPango::PlatformFontPango() {
- if (default_font_ == NULL) {
- std::string font_name = GetDefaultFont();
+ if (!default_font_) {
+ std::string desc_string;
+#if defined(OS_CHROMEOS)
+ // Font name must have been provided by way of SetDefaultFontDescription().
+ CHECK(default_font_description_);
+ desc_string = *default_font_description_;
+#else
+ const gfx::LinuxFontDelegate* delegate = gfx::LinuxFontDelegate::instance();
+ desc_string = delegate ? delegate->GetDefaultFontDescription() : "sans 10";
+#endif
ScopedPangoFontDescription desc(
- pango_font_description_from_string(font_name.c_str()));
+ pango_font_description_from_string(desc_string.c_str()));
default_font_ = new Font(desc.get());
-
- DCHECK(default_font_);
}
InitFromPlatformFont(
@@ -248,18 +254,6 @@ PlatformFontPango::PlatformFontPango(const skia::RefPtr<SkTypeface>& typeface,
PlatformFontPango::~PlatformFontPango() {}
-// static
-std::string PlatformFontPango::GetDefaultFont() {
-#if defined(OS_CHROMEOS)
- // Font name must have been provided by way of SetDefaultFontDescription().
- CHECK(default_font_description_);
- return *default_font_description_;
-#else
- const gfx::LinuxFontDelegate* delegate = gfx::LinuxFontDelegate::instance();
- return delegate ? delegate->GetDefaultFontDescription() : "sans 10";
-#endif // defined(OS_CHROMEOS)
-}
-
void PlatformFontPango::InitFromDetails(
const skia::RefPtr<SkTypeface>& typeface,
const std::string& font_family,
« no previous file with comments | « ui/gfx/platform_font_pango.h ('k') | ui/gfx/render_text_pango.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698