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

Unified Diff: ui/gfx/platform_font_pango.cc

Issue 400193004: Unify desktop Linux and Chrome OS font rendering params. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update some comments 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
« ui/gfx/linux_font_delegate.h ('K') | « ui/gfx/platform_font_pango.h ('k') | no next file » | 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 2c89ac5baa83d035803e66bf05c0bf492fd48ca3..fdae6ae0604e71c051cac807461264e2b927c927 100644
--- a/ui/gfx/platform_font_pango.cc
+++ b/ui/gfx/platform_font_pango.cc
@@ -48,19 +48,24 @@ std::string* PlatformFontPango::default_font_description_ = NULL;
PlatformFontPango::PlatformFontPango() {
if (!default_font_) {
- std::string desc_string;
+ scoped_ptr<ScopedPangoFontDescription> desc;
msw 2014/07/18 19:14:44 nit: |description| shouldn't cause any extra wrapp
Daniel Erat 2014/07/18 19:39:09 Done.
+ const gfx::LinuxFontDelegate* delegate = gfx::LinuxFontDelegate::instance();
+ if (delegate)
+ desc = delegate->GetDefaultPangoFontDescription();
+
+ if (!desc.get()) {
+ 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_;
+ CHECK(default_font_description_);
msw 2014/07/18 19:14:44 ChromeOS uses InitDefaultFontList() to set a speci
Daniel Erat 2014/07/18 19:39:09 chrome os doesn't use a LinuxFontDelegate (althoug
msw 2014/07/18 19:59:46 Hmm, I think the latest patch set is a bit safer f
+ desc_string = *default_font_description_;
#else
- const gfx::LinuxFontDelegate* delegate = gfx::LinuxFontDelegate::instance();
- desc_string = delegate ? delegate->GetDefaultFontDescription() : "sans 10";
+ desc_string = "sans 10";
#endif
+ desc.reset(new ScopedPangoFontDescription(
+ pango_font_description_from_string(desc_string.c_str())));
+ }
- ScopedPangoFontDescription desc(
- pango_font_description_from_string(desc_string.c_str()));
- default_font_ = new Font(desc.get());
+ default_font_ = new Font(desc->get());
}
InitFromPlatformFont(
« ui/gfx/linux_font_delegate.h ('K') | « ui/gfx/platform_font_pango.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698