Chromium Code Reviews| 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( |