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

Unified Diff: src/ports/SkTypeface_win_dw.cpp

Issue 574873002: Add onGetFamilyName to SkTypeface. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add .get() for DirectWrite. Created 6 years, 3 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
« no previous file with comments | « src/ports/SkTypeface_win_dw.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « src/ports/SkTypeface_win_dw.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698