Index: src/ports/SkTypeface_win_dw.cpp |
diff --git a/src/ports/SkTypeface_win_dw.cpp b/src/ports/SkTypeface_win_dw.cpp |
index 9c727e715eadeff3cd1a33ce997b146f1d099dc7..9c2b41d44cddecf8482caee211cfe6ec2e5d6c14 100644 |
--- a/src/ports/SkTypeface_win_dw.cpp |
+++ b/src/ports/SkTypeface_win_dw.cpp |
@@ -12,6 +12,7 @@ |
// not use GDI, undefing GetGlyphIndices makes things less confusing. |
#undef GetGlyphIndices |
+#include "SkDWrite.h" |
#include "SkDWriteFontFileStream.h" |
#include "SkFontDescriptor.h" |
#include "SkFontStream.h" |
@@ -24,20 +25,21 @@ |
#include "SkTypeface_win_dw.h" |
#include "SkUtils.h" |
+void DWriteFontTypeface::onGetFamilyName(SkString* familyName) const { |
+ SkTScopedComPtr<IDWriteLocalizedStrings> familyNames; |
+ HRV(fDWriteFontFamily->GetFamilyNames(&familyNames)); |
+ |
+ sk_get_locale_string(familyNames.get(), NULL/*fMgr->fLocaleName.get()*/, familyName); |
+} |
+ |
void DWriteFontTypeface::onGetFontDescriptor(SkFontDescriptor* desc, |
bool* isLocalStream) const { |
// Get the family name. |
SkTScopedComPtr<IDWriteLocalizedStrings> familyNames; |
HRV(fDWriteFontFamily->GetFamilyNames(&familyNames)); |
- UINT32 familyNamesLen; |
- HRV(familyNames->GetStringLength(0, &familyNamesLen)); |
- |
- SkSMallocWCHAR familyName(familyNamesLen+1); |
- HRV(familyNames->GetString(0, familyName.get(), familyNamesLen+1)); |
- |
SkString utf8FamilyName; |
- HRV(sk_wchar_to_skstring(familyName.get(), familyNamesLen, &utf8FamilyName)); |
+ sk_get_locale_string(familyNames.get(), NULL/*fMgr->fLocaleName.get()*/, &utf8FamilyName); |
desc->setFamilyName(utf8FamilyName.c_str()); |
*isLocalStream = SkToBool(fDWriteFontFileLoader.get()); |