Index: gfx/platform_font_gtk.cc |
=================================================================== |
--- gfx/platform_font_gtk.cc (revision 71043) |
+++ gfx/platform_font_gtk.cc (working copy) |
@@ -13,7 +13,6 @@ |
#include "base/logging.h" |
#include "base/string_piece.h" |
-#include "base/sys_string_conversions.h" |
#include "base/utf_string_conversions.h" |
#include "gfx/canvas_skia.h" |
#include "gfx/font.h" |
@@ -67,7 +66,7 @@ |
// PGothic". In this case, SkTypeface for "Sans" returns NULL even if |
// the system has a font for "Sans" font family. See FontMatch() in |
// skia/ports/SkFontHost_fontconfig.cpp for more detail. |
-std::wstring FindBestMatchFontFamilyName(const char* family_name) { |
+string16 FindBestMatchFontFamilyName(const char* family_name) { |
FcPattern* pattern = FcPatternCreate(); |
FcValue fcvalue; |
fcvalue.type = FcTypeString; |
@@ -82,7 +81,7 @@ |
FcChar8* match_family; |
FcPatternGetString(match, FC_FAMILY, 0, &match_family); |
- std::wstring font_family = UTF8ToWide(reinterpret_cast<char*>(match_family)); |
+ string16 font_family = UTF8ToUTF16(reinterpret_cast<char*>(match_family)); |
FcPatternDestroy(match); |
FcPatternDestroy(pattern); |
free(family_name_copy); |
@@ -141,7 +140,7 @@ |
// Find best match font for |family_name| to make sure we can get |
// a SkTypeface for the default font. |
// TODO(agl): remove this. |
- std::wstring font_family = FindBestMatchFontFamilyName(family_name); |
+ string16 font_family = FindBestMatchFontFamilyName(family_name); |
InitWithNameAndSize(font_family, size / PANGO_SCALE); |
int style = 0; |
@@ -158,7 +157,7 @@ |
style_ = style; |
} |
-PlatformFontGtk::PlatformFontGtk(const std::wstring& font_name, |
+PlatformFontGtk::PlatformFontGtk(const string16& font_name, |
int font_size) { |
InitWithNameAndSize(font_name, font_size); |
} |
@@ -197,7 +196,7 @@ |
skstyle |= SkTypeface::kItalic; |
SkTypeface* typeface = SkTypeface::CreateFromName( |
- base::SysWideToUTF8(font_family_).c_str(), |
+ UTF16ToUTF8(font_family_).c_str(), |
static_cast<SkTypeface::Style>(skstyle)); |
SkAutoUnref tf_helper(typeface); |
@@ -235,7 +234,7 @@ |
return style_; |
} |
-const std::wstring& PlatformFontGtk::GetFontName() const { |
+string16 PlatformFontGtk::GetFontName() const { |
return font_family_; |
} |
@@ -245,7 +244,7 @@ |
NativeFont PlatformFontGtk::GetNativeFont() const { |
PangoFontDescription* pfd = pango_font_description_new(); |
- pango_font_description_set_family(pfd, WideToUTF8(GetFontName()).c_str()); |
+ pango_font_description_set_family(pfd, UTF16ToUTF8(GetFontName()).c_str()); |
// Set the absolute size to avoid overflowing UI elements. |
pango_font_description_set_absolute_size(pfd, |
GetFontSize() * PANGO_SCALE * GetPangoScaleFactor()); |
@@ -273,7 +272,7 @@ |
// PlatformFontGtk, private: |
PlatformFontGtk::PlatformFontGtk(SkTypeface* typeface, |
- const std::wstring& name, |
+ const string16& name, |
int size, |
int style) { |
InitWithTypefaceNameSizeAndStyle(typeface, name, size, style); |
@@ -281,22 +280,22 @@ |
PlatformFontGtk::~PlatformFontGtk() {} |
-void PlatformFontGtk::InitWithNameAndSize(const std::wstring& font_name, |
+void PlatformFontGtk::InitWithNameAndSize(const string16& font_name, |
int font_size) { |
DCHECK_GT(font_size, 0); |
- std::wstring fallback; |
+ string16 fallback; |
SkTypeface* typeface = SkTypeface::CreateFromName( |
- base::SysWideToUTF8(font_name).c_str(), SkTypeface::kNormal); |
+ UTF16ToUTF8(font_name).c_str(), SkTypeface::kNormal); |
if (!typeface) { |
// A non-scalable font such as .pcf is specified. Falls back to a default |
// scalable font. |
typeface = SkTypeface::CreateFromName( |
kFallbackFontFamilyName, SkTypeface::kNormal); |
CHECK(typeface) << "Could not find any font: " |
- << base::SysWideToUTF8(font_name) |
+ << UTF16ToUTF8(font_name) |
<< ", " << kFallbackFontFamilyName; |
- fallback = base::SysUTF8ToWide(kFallbackFontFamilyName); |
+ fallback = UTF8ToUTF16(kFallbackFontFamilyName); |
} |
SkAutoUnref typeface_helper(typeface); |
@@ -308,7 +307,7 @@ |
void PlatformFontGtk::InitWithTypefaceNameSizeAndStyle( |
SkTypeface* typeface, |
- const std::wstring& font_family, |
+ const string16& font_family, |
int font_size, |
int style) { |
typeface_helper_.reset(new SkAutoUnref(typeface)); |
@@ -435,7 +434,7 @@ |
} |
// static |
-PlatformFont* PlatformFont::CreateFromNameAndSize(const std::wstring& font_name, |
+PlatformFont* PlatformFont::CreateFromNameAndSize(const string16& font_name, |
int font_size) { |
return new PlatformFontGtk(font_name, font_size); |
} |