OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkTypes.h" | 8 #include "SkTypes.h" |
9 #undef GetGlyphIndices | 9 #undef GetGlyphIndices |
10 | 10 |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 } | 485 } |
486 | 486 |
487 protected: | 487 protected: |
488 virtual SkStream* onOpenStream(int* ttcIndex) const SK_OVERRIDE; | 488 virtual SkStream* onOpenStream(int* ttcIndex) const SK_OVERRIDE; |
489 virtual SkScalerContext* onCreateScalerContext(const SkDescriptor*) const SK
_OVERRIDE; | 489 virtual SkScalerContext* onCreateScalerContext(const SkDescriptor*) const SK
_OVERRIDE; |
490 virtual void onFilterRec(SkScalerContextRec*) const SK_OVERRIDE; | 490 virtual void onFilterRec(SkScalerContextRec*) const SK_OVERRIDE; |
491 virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( | 491 virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( |
492 SkAdvancedTypefaceMetrics::PerGlyphInfo, | 492 SkAdvancedTypefaceMetrics::PerGlyphInfo, |
493 const uint32_t*, uint32_t) const SK_OVERRIDE; | 493 const uint32_t*, uint32_t) const SK_OVERRIDE; |
494 virtual void onGetFontDescriptor(SkFontDescriptor*, bool*) const SK_OVERRIDE
; | 494 virtual void onGetFontDescriptor(SkFontDescriptor*, bool*) const SK_OVERRIDE
; |
| 495 virtual int onCountGlyphs() const SK_OVERRIDE; |
| 496 virtual int onGetUPEM() const SK_OVERRIDE; |
495 }; | 497 }; |
496 | 498 |
497 class SkScalerContext_Windows : public SkScalerContext { | 499 class SkScalerContext_Windows : public SkScalerContext { |
498 public: | 500 public: |
499 SkScalerContext_Windows(DWriteFontTypeface*, const SkDescriptor* desc); | 501 SkScalerContext_Windows(DWriteFontTypeface*, const SkDescriptor* desc); |
500 virtual ~SkScalerContext_Windows(); | 502 virtual ~SkScalerContext_Windows(); |
501 | 503 |
502 protected: | 504 protected: |
503 virtual unsigned generateGlyphCount() SK_OVERRIDE; | 505 virtual unsigned generateGlyphCount() SK_OVERRIDE; |
504 virtual uint16_t generateCharToGlyph(SkUnichar uni) SK_OVERRIDE; | 506 virtual uint16_t generateCharToGlyph(SkUnichar uni) SK_OVERRIDE; |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 SkSMallocWCHAR dwFamilyNameChar(dwFamilyNamesLength+1); | 1066 SkSMallocWCHAR dwFamilyNameChar(dwFamilyNamesLength+1); |
1065 HRV(dwFamilyNames->GetString(0, dwFamilyNameChar.get(), dwFamilyNamesLength+
1)); | 1067 HRV(dwFamilyNames->GetString(0, dwFamilyNameChar.get(), dwFamilyNamesLength+
1)); |
1066 | 1068 |
1067 SkString utf8FamilyName; | 1069 SkString utf8FamilyName; |
1068 HRV(wchar_to_skstring(dwFamilyNameChar.get(), &utf8FamilyName)); | 1070 HRV(wchar_to_skstring(dwFamilyNameChar.get(), &utf8FamilyName)); |
1069 | 1071 |
1070 desc->setFamilyName(utf8FamilyName.c_str()); | 1072 desc->setFamilyName(utf8FamilyName.c_str()); |
1071 *isLocalStream = SkToBool(fDWriteFontFileLoader.get()); | 1073 *isLocalStream = SkToBool(fDWriteFontFileLoader.get()); |
1072 } | 1074 } |
1073 | 1075 |
| 1076 int DWriteFontTypeface::onCountGlyphs() const { |
| 1077 return fDWriteFontFace->GetGlyphCount(); |
| 1078 } |
| 1079 |
| 1080 int DWriteFontTypeface::onGetUPEM() const { |
| 1081 DWRITE_FONT_METRICS metrics; |
| 1082 fDWriteFontFace->GetMetrics(&metrics); |
| 1083 return metrics.designUnitsPerEm; |
| 1084 } |
| 1085 |
1074 template <typename T> class SkAutoIDWriteUnregister { | 1086 template <typename T> class SkAutoIDWriteUnregister { |
1075 public: | 1087 public: |
1076 SkAutoIDWriteUnregister(IDWriteFactory* factory, T* unregister) | 1088 SkAutoIDWriteUnregister(IDWriteFactory* factory, T* unregister) |
1077 : fFactory(factory), fUnregister(unregister) | 1089 : fFactory(factory), fUnregister(unregister) |
1078 { } | 1090 { } |
1079 | 1091 |
1080 ~SkAutoIDWriteUnregister() { | 1092 ~SkAutoIDWriteUnregister() { |
1081 if (fUnregister) { | 1093 if (fUnregister) { |
1082 unregister(fFactory, fUnregister); | 1094 unregister(fFactory, fUnregister); |
1083 } | 1095 } |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1748 | 1760 |
1749 WCHAR localeNameStorage[LOCALE_NAME_MAX_LENGTH]; | 1761 WCHAR localeNameStorage[LOCALE_NAME_MAX_LENGTH]; |
1750 WCHAR* localeName = NULL; | 1762 WCHAR* localeName = NULL; |
1751 int localeNameLen = GetUserDefaultLocaleName(localeNameStorage, LOCALE_NAME_
MAX_LENGTH); | 1763 int localeNameLen = GetUserDefaultLocaleName(localeNameStorage, LOCALE_NAME_
MAX_LENGTH); |
1752 if (localeNameLen) { | 1764 if (localeNameLen) { |
1753 localeName = localeNameStorage; | 1765 localeName = localeNameStorage; |
1754 }; | 1766 }; |
1755 | 1767 |
1756 return SkNEW_ARGS(SkFontMgr_DirectWrite, (sysFontCollection.get(), localeNam
e, localeNameLen)); | 1768 return SkNEW_ARGS(SkFontMgr_DirectWrite, (sysFontCollection.get(), localeNam
e, localeNameLen)); |
1757 } | 1769 } |
OLD | NEW |