OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 #include "SkTypes.h" | 7 #include "SkTypes.h" |
8 #if defined(SK_BUILD_FOR_WIN32) | 8 #if defined(SK_BUILD_FOR_WIN32) |
9 | 9 |
10 #include "SkDWrite.h" | 10 #include "SkDWrite.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 /** localeNameLength must include the null terminator. */ | 84 /** localeNameLength must include the null terminator. */ |
85 SkRemotableFontMgr_DirectWrite(IDWriteFontCollection* fontCollection, | 85 SkRemotableFontMgr_DirectWrite(IDWriteFontCollection* fontCollection, |
86 WCHAR* localeName, int localeNameLength) | 86 WCHAR* localeName, int localeNameLength) |
87 : fFontCollection(SkRefComPtr(fontCollection)) | 87 : fFontCollection(SkRefComPtr(fontCollection)) |
88 , fLocaleName(localeNameLength) | 88 , fLocaleName(localeNameLength) |
89 { | 89 { |
90 memcpy(fLocaleName.get(), localeName, localeNameLength * sizeof(WCHAR)); | 90 memcpy(fLocaleName.get(), localeName, localeNameLength * sizeof(WCHAR)); |
91 } | 91 } |
92 | 92 |
93 SkDataTable* getFamilyNames() const override { | 93 sk_sp<SkDataTable> getFamilyNames() const override { |
94 int count = fFontCollection->GetFontFamilyCount(); | 94 int count = fFontCollection->GetFontFamilyCount(); |
95 | 95 |
96 SkDataTableBuilder names(1024); | 96 SkDataTableBuilder names(1024); |
97 for (int index = 0; index < count; ++index) { | 97 for (int index = 0; index < count; ++index) { |
98 SkTScopedComPtr<IDWriteFontFamily> fontFamily; | 98 SkTScopedComPtr<IDWriteFontFamily> fontFamily; |
99 HRNM(fFontCollection->GetFontFamily(index, &fontFamily), | 99 HRNM(fFontCollection->GetFontFamily(index, &fontFamily), |
100 "Could not get requested family."); | 100 "Could not get requested family."); |
101 | 101 |
102 SkTScopedComPtr<IDWriteLocalizedStrings> familyNames; | 102 SkTScopedComPtr<IDWriteLocalizedStrings> familyNames; |
103 HRNM(fontFamily->GetFamilyNames(&familyNames), "Could not get family
names."); | 103 HRNM(fontFamily->GetFamilyNames(&familyNames), "Could not get family
names."); |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 } else { | 481 } else { |
482 localeNameLen = getUserDefaultLocaleNameProc(localeNameStorage, LOCALE_N
AME_MAX_LENGTH); | 482 localeNameLen = getUserDefaultLocaleNameProc(localeNameStorage, LOCALE_N
AME_MAX_LENGTH); |
483 if (localeNameLen) { | 483 if (localeNameLen) { |
484 localeName = localeNameStorage; | 484 localeName = localeNameStorage; |
485 }; | 485 }; |
486 } | 486 } |
487 | 487 |
488 return new SkRemotableFontMgr_DirectWrite(sysFontCollection.get(), localeNam
e, localeNameLen); | 488 return new SkRemotableFontMgr_DirectWrite(sysFontCollection.get(), localeNam
e, localeNameLen); |
489 } | 489 } |
490 #endif//defined(SK_BUILD_FOR_WIN32) | 490 #endif//defined(SK_BUILD_FOR_WIN32) |
OLD | NEW |