| 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 | 7 |
| 8 #include "SkDWrite.h" | 8 #include "SkDWrite.h" |
| 9 #include "SkDWriteFontFileStream.h" | 9 #include "SkDWriteFontFileStream.h" |
| 10 #include "SkFontMgr.h" | 10 #include "SkFontMgr.h" |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 memcpy(fLocaleName.get(), localeName, localeNameLength * sizeof(WCHAR)); | 263 memcpy(fLocaleName.get(), localeName, localeNameLength * sizeof(WCHAR)); |
| 264 } | 264 } |
| 265 | 265 |
| 266 protected: | 266 protected: |
| 267 virtual int onCountFamilies() const SK_OVERRIDE; | 267 virtual int onCountFamilies() const SK_OVERRIDE; |
| 268 virtual void onGetFamilyName(int index, SkString* familyName) const SK_OVERR
IDE; | 268 virtual void onGetFamilyName(int index, SkString* familyName) const SK_OVERR
IDE; |
| 269 virtual SkFontStyleSet* onCreateStyleSet(int index) const SK_OVERRIDE; | 269 virtual SkFontStyleSet* onCreateStyleSet(int index) const SK_OVERRIDE; |
| 270 virtual SkFontStyleSet* onMatchFamily(const char familyName[]) const SK_OVER
RIDE; | 270 virtual SkFontStyleSet* onMatchFamily(const char familyName[]) const SK_OVER
RIDE; |
| 271 virtual SkTypeface* onMatchFamilyStyle(const char familyName[], | 271 virtual SkTypeface* onMatchFamilyStyle(const char familyName[], |
| 272 const SkFontStyle& fontstyle) const S
K_OVERRIDE; | 272 const SkFontStyle& fontstyle) const S
K_OVERRIDE; |
| 273 virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], con
st SkFontStyle&, |
| 274 const char* bcp47[], int bcp
47Count, |
| 275 SkUnichar character) const S
K_OVERRIDE; |
| 273 virtual SkTypeface* onMatchFaceStyle(const SkTypeface* familyMember, | 276 virtual SkTypeface* onMatchFaceStyle(const SkTypeface* familyMember, |
| 274 const SkFontStyle& fontstyle) const SK_
OVERRIDE; | 277 const SkFontStyle& fontstyle) const SK_
OVERRIDE; |
| 275 virtual SkTypeface* onCreateFromStream(SkStream* stream, int ttcIndex) const
SK_OVERRIDE; | 278 virtual SkTypeface* onCreateFromStream(SkStream* stream, int ttcIndex) const
SK_OVERRIDE; |
| 276 virtual SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const SK_OV
ERRIDE; | 279 virtual SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const SK_OV
ERRIDE; |
| 277 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const
SK_OVERRIDE; | 280 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const
SK_OVERRIDE; |
| 278 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], | 281 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], |
| 279 unsigned styleBits) const SK_OVER
RIDE; | 282 unsigned styleBits) const SK_OVER
RIDE; |
| 280 | 283 |
| 281 private: | 284 private: |
| 282 HRESULT getByFamilyName(const WCHAR familyName[], IDWriteFontFamily** fontFa
mily) const; | 285 HRESULT getByFamilyName(const WCHAR familyName[], IDWriteFontFamily** fontFa
mily) const; |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 | 479 |
| 477 return this->onCreateStyleSet(index); | 480 return this->onCreateStyleSet(index); |
| 478 } | 481 } |
| 479 | 482 |
| 480 SkTypeface* SkFontMgr_DirectWrite::onMatchFamilyStyle(const char familyName[], | 483 SkTypeface* SkFontMgr_DirectWrite::onMatchFamilyStyle(const char familyName[], |
| 481 const SkFontStyle& fontsty
le) const { | 484 const SkFontStyle& fontsty
le) const { |
| 482 SkAutoTUnref<SkFontStyleSet> sset(this->matchFamily(familyName)); | 485 SkAutoTUnref<SkFontStyleSet> sset(this->matchFamily(familyName)); |
| 483 return sset->matchStyle(fontstyle); | 486 return sset->matchStyle(fontstyle); |
| 484 } | 487 } |
| 485 | 488 |
| 489 SkTypeface* SkFontMgr_DirectWrite::onMatchFamilyStyleCharacter(const char family
Name[], |
| 490 const SkFontStyle
&, |
| 491 const char* bcp47
[], int bcp47Count, |
| 492 SkUnichar charact
er) const { |
| 493 return NULL; |
| 494 } |
| 495 |
| 486 SkTypeface* SkFontMgr_DirectWrite::onMatchFaceStyle(const SkTypeface* familyMemb
er, | 496 SkTypeface* SkFontMgr_DirectWrite::onMatchFaceStyle(const SkTypeface* familyMemb
er, |
| 487 const SkFontStyle& fontstyle
) const { | 497 const SkFontStyle& fontstyle
) const { |
| 488 SkString familyName; | 498 SkString familyName; |
| 489 SkFontStyleSet_DirectWrite sset( | 499 SkFontStyleSet_DirectWrite sset( |
| 490 this, ((DWriteFontTypeface*)familyMember)->fDWriteFontFamily.get() | 500 this, ((DWriteFontTypeface*)familyMember)->fDWriteFontFamily.get() |
| 491 ); | 501 ); |
| 492 return sset.matchStyle(fontstyle); | 502 return sset.matchStyle(fontstyle); |
| 493 } | 503 } |
| 494 | 504 |
| 495 template <typename T> class SkAutoIDWriteUnregister { | 505 template <typename T> class SkAutoIDWriteUnregister { |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 } | 765 } |
| 756 | 766 |
| 757 #include "SkFontMgr_indirect.h" | 767 #include "SkFontMgr_indirect.h" |
| 758 SK_API SkFontMgr* SkFontMgr_New_DirectWriteRenderer(SkRemotableFontMgr* proxy) { | 768 SK_API SkFontMgr* SkFontMgr_New_DirectWriteRenderer(SkRemotableFontMgr* proxy) { |
| 759 SkAutoTUnref<SkFontMgr> impl(SkFontMgr_New_DirectWrite()); | 769 SkAutoTUnref<SkFontMgr> impl(SkFontMgr_New_DirectWrite()); |
| 760 if (impl.get() == NULL) { | 770 if (impl.get() == NULL) { |
| 761 return NULL; | 771 return NULL; |
| 762 } | 772 } |
| 763 return SkNEW_ARGS(SkFontMgr_Indirect, (impl.get(), proxy)); | 773 return SkNEW_ARGS(SkFontMgr_Indirect, (impl.get(), proxy)); |
| 764 } | 774 } |
| OLD | NEW |