diff options
author | bungeman <bungeman@google.com> | 2014-10-23 07:08:05 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-23 07:08:06 -0700 |
commit | c20386e3937d3d398ac9b35f9c7d997e972ade98 (patch) | |
tree | a8c66e05bad1508b43b2689edf3773b2b9f34595 /src/ports/SkRemotableFontMgr_win_dw.cpp | |
parent | 7fdffe41494cbd78a8ee2a6ef0509e46ec77039f (diff) |
Update fontMgr to take list of bcp47 language tags.
This will enable clients to pass more than one bcp47 tag to ensure
that the most appropriate font is selected.
BUG=chromium:422180
Review URL: https://codereview.chromium.org/670243002
Diffstat (limited to 'src/ports/SkRemotableFontMgr_win_dw.cpp')
-rw-r--r-- | src/ports/SkRemotableFontMgr_win_dw.cpp | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/ports/SkRemotableFontMgr_win_dw.cpp b/src/ports/SkRemotableFontMgr_win_dw.cpp index d979683273..9fef440d83 100644 --- a/src/ports/SkRemotableFontMgr_win_dw.cpp +++ b/src/ports/SkRemotableFontMgr_win_dw.cpp @@ -408,11 +408,21 @@ public: SkFontIdentity fIdentity; }; +#ifdef SK_FM_NEW_MATCH_FAMILY_STYLE_CHARACTER + virtual SkFontIdentity matchNameStyleCharacter(const char familyName[], + const SkFontStyle&, pattern + const char* bcp47[], int bcp47Count, + SkUnichar character) const SK_OVERRIDE + { +#else virtual SkFontIdentity matchNameStyleCharacter(const char familyName[], const SkFontStyle& pattern, - const char bpc47[], - SkUnichar character) const SK_OVERRIDE + const char bcp47_val[], + SkUnichar character) const SK_OVERRIDE { + const char** bcp47 = &bcp47_val; + int bcp47Count = bcp47_val ? 1 : 0; +#endif SkFontIdentity identity = { SkFontIdentity::kInvalidDataId }; IDWriteFactory* dwFactory = sk_get_dwrite_factory(); @@ -431,13 +441,14 @@ public: HR_GENERAL(sk_cstring_to_wchar(familyName, &dwFamilyName), NULL, identity); } - const SkSMallocWCHAR* dwBpc47; - SkSMallocWCHAR dwBpc47Local; - if (NULL == bpc47) { - dwBpc47 = &fLocaleName; + const SkSMallocWCHAR* dwBcp47; + SkSMallocWCHAR dwBcp47Local; + if (bcp47Count < 1) { + dwBcp47 = &fLocaleName; } else { - HR_GENERAL(sk_cstring_to_wchar(bpc47, &dwBpc47Local), NULL, identity); - dwBpc47 = &dwBpc47Local; + //TODO: support fallback stack. + HR_GENERAL(sk_cstring_to_wchar(bcp47[bcp47Count-1], &dwBcp47Local), NULL, identity); + dwBcp47 = &dwBcp47Local; } SkTScopedComPtr<IDWriteTextFormat> fallbackFormat; @@ -447,7 +458,7 @@ public: dwStyle.fSlant, dwStyle.fWidth, 72.0f, - *dwBpc47, + *dwBcp47, &fallbackFormat), "Could not create text format.", identity); |