diff options
author | bungeman <bungeman@google.com> | 2015-08-18 09:34:07 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-18 09:34:07 -0700 |
commit | f05271581fc6204c2b7ccf146af5d02eec27e670 (patch) | |
tree | bf3d89b9ba9d4f592706b392771d051070e6039a | |
parent | 5346983b2e0726b4009cc546b01c58a8919e6c36 (diff) |
Use portable code for family names with DirectWrite.
IDWriteFamily::GetFamilyNames appears to be 'helpful' and removes
parts of family names that look like style names. Since the iterator
is supposed to return the actual names and not just the name the
platform thinks the name is (as getFamilyName does), try returning
the raw names when possible.
BUG=skia:4217
Review URL: https://codereview.chromium.org/1302573002
-rw-r--r-- | src/ports/SkTypeface_win_dw.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/ports/SkTypeface_win_dw.cpp b/src/ports/SkTypeface_win_dw.cpp index 6506118321..90dc2c49ad 100644 --- a/src/ports/SkTypeface_win_dw.cpp +++ b/src/ports/SkTypeface_win_dw.cpp @@ -20,6 +20,7 @@ #include "SkOTTable_hhea.h" #include "SkOTTable_OS_2.h" #include "SkOTTable_post.h" +#include "SkOTUtils.h" #include "SkScalerContext.h" #include "SkScalerContext_win_dw.h" #include "SkTypeface_win_dw.h" @@ -169,10 +170,14 @@ private: }; SkTypeface::LocalizedStrings* DWriteFontTypeface::onCreateFamilyNameIterator() const { - SkTScopedComPtr<IDWriteLocalizedStrings> familyNames; - HRNM(fDWriteFontFamily->GetFamilyNames(&familyNames), "Could not obtain family names."); - - return new LocalizedStrings_IDWriteLocalizedStrings(familyNames.release()); + SkTypeface::LocalizedStrings* nameIter = + SkOTUtils::LocalizedStrings_NameTable::CreateForFamilyNames(*this); + if (NULL == nameIter) { + SkTScopedComPtr<IDWriteLocalizedStrings> familyNames; + HRNM(fDWriteFontFamily->GetFamilyNames(&familyNames), "Could not obtain family names."); + nameIter = new LocalizedStrings_IDWriteLocalizedStrings(familyNames.release()); + } + return nameIter; } int DWriteFontTypeface::onGetTableTags(SkFontTableTag tags[]) const { |