Index: ui/gfx/pango_util.cc |
=================================================================== |
--- ui/gfx/pango_util.cc (revision 137485) |
+++ ui/gfx/pango_util.cc (working copy) |
@@ -8,6 +8,7 @@ |
#include <fontconfig/fontconfig.h> |
#include <pango/pango.h> |
#include <pango/pangocairo.h> |
+#include <string> |
#include <algorithm> |
#include <map> |
@@ -19,6 +20,7 @@ |
#include "ui/gfx/font.h" |
#include "ui/gfx/platform_font_pango.h" |
#include "ui/gfx/rect.h" |
+#include "ui/gfx/skia_util.h" |
#if defined(TOOLKIT_GTK) |
#include <gdk/gdk.h> |
@@ -29,8 +31,6 @@ |
#include "ui/base/ui_base_switches.h" |
#endif |
-#include "ui/gfx/skia_util.h" |
- |
namespace { |
// Marker for accelerators in the text. |
@@ -352,9 +352,8 @@ |
int flags) { |
SetupPangoLayoutWithoutFont(layout, text, width, text_direction, flags); |
- PangoFontDescription* desc = font.GetNativeFont(); |
- pango_layout_set_font_description(layout, desc); |
- pango_font_description_free(desc); |
+ ScopedPangoFontDescription desc(font.GetNativeFont()); |
+ pango_layout_set_font_description(layout, desc.get()); |
} |
void SetupPangoLayoutWithFontDescription( |
@@ -366,10 +365,9 @@ |
int flags) { |
SetupPangoLayoutWithoutFont(layout, text, width, text_direction, flags); |
- PangoFontDescription* desc = pango_font_description_from_string( |
- font_description.c_str()); |
- pango_layout_set_font_description(layout, desc); |
- pango_font_description_free(desc); |
+ ScopedPangoFontDescription desc( |
+ pango_font_description_from_string(font_description.c_str())); |
+ pango_layout_set_font_description(layout, desc.get()); |
} |
void AdjustTextRectBasedOnLayout(PangoLayout* layout, |