| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #ifndef SkFontMgr_DEFINED | 8 #ifndef SkFontMgr_DEFINED |
| 9 #define SkFontMgr_DEFINED | 9 #define SkFontMgr_DEFINED |
| 10 | 10 |
| 11 #include "SkRefCnt.h" | 11 #include "SkRefCnt.h" |
| 12 #include "SkFontStyle.h" | 12 #include "SkFontStyle.h" |
| 13 | 13 |
| 14 class SkData; | 14 class SkData; |
| 15 class SkFontParameters; |
| 15 class SkStreamAsset; | 16 class SkStreamAsset; |
| 16 class SkString; | 17 class SkString; |
| 17 class SkTypeface; | 18 class SkTypeface; |
| 18 | 19 |
| 19 class SK_API SkFontStyleSet : public SkRefCnt { | 20 class SK_API SkFontStyleSet : public SkRefCnt { |
| 20 public: | 21 public: |
| 21 SK_DECLARE_INST_COUNT(SkFontStyleSet) | 22 SK_DECLARE_INST_COUNT(SkFontStyleSet) |
| 22 | 23 |
| 23 virtual int count() = 0; | 24 virtual int count() = 0; |
| 24 virtual void getStyle(int index, SkFontStyle*, SkString* style) = 0; | 25 virtual void getStyle(int index, SkFontStyle*, SkString* style) = 0; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 SkTypeface* legacyCreateTypeface(const char familyName[], | 106 SkTypeface* legacyCreateTypeface(const char familyName[], |
| 106 unsigned typefaceStyleBits) const; | 107 unsigned typefaceStyleBits) const; |
| 107 | 108 |
| 108 /** | 109 /** |
| 109 * Return a ref to the default fontmgr. The caller must call unref() on | 110 * Return a ref to the default fontmgr. The caller must call unref() on |
| 110 * the returned object. | 111 * the returned object. |
| 111 */ | 112 */ |
| 112 static SkFontMgr* RefDefault(); | 113 static SkFontMgr* RefDefault(); |
| 113 | 114 |
| 114 protected: | 115 protected: |
| 116 friend class SkTypeface; |
| 117 SkTypeface* createFromStream(SkStreamAsset*, const SkFontParameters&) const; |
| 118 |
| 115 virtual int onCountFamilies() const = 0; | 119 virtual int onCountFamilies() const = 0; |
| 116 virtual void onGetFamilyName(int index, SkString* familyName) const = 0; | 120 virtual void onGetFamilyName(int index, SkString* familyName) const = 0; |
| 117 virtual SkFontStyleSet* onCreateStyleSet(int index)const = 0; | 121 virtual SkFontStyleSet* onCreateStyleSet(int index)const = 0; |
| 118 | 122 |
| 119 /** May return NULL if the name is not found. */ | 123 /** May return NULL if the name is not found. */ |
| 120 virtual SkFontStyleSet* onMatchFamily(const char familyName[]) const = 0; | 124 virtual SkFontStyleSet* onMatchFamily(const char familyName[]) const = 0; |
| 121 | 125 |
| 122 virtual SkTypeface* onMatchFamilyStyle(const char familyName[], | 126 virtual SkTypeface* onMatchFamilyStyle(const char familyName[], |
| 123 const SkFontStyle&) const = 0; | 127 const SkFontStyle&) const = 0; |
| 124 virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], con
st SkFontStyle&, | 128 virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], con
st SkFontStyle&, |
| 125 const char* bcp47[], int bcp
47Count, | 129 const char* bcp47[], int bcp
47Count, |
| 126 SkUnichar character) const =
0; | 130 SkUnichar character) const =
0; |
| 127 virtual SkTypeface* onMatchFaceStyle(const SkTypeface*, | 131 virtual SkTypeface* onMatchFaceStyle(const SkTypeface*, |
| 128 const SkFontStyle&) const = 0; | 132 const SkFontStyle&) const = 0; |
| 129 | 133 |
| 130 virtual SkTypeface* onCreateFromData(SkData*, int ttcIndex) const = 0; | 134 virtual SkTypeface* onCreateFromData(SkData*, int ttcIndex) const = 0; |
| 131 virtual SkTypeface* onCreateFromStream(SkStreamAsset*, int ttcIndex) const =
0; | 135 virtual SkTypeface* onCreateFromStream(SkStreamAsset*, int ttcIndex) const =
0; |
| 136 virtual SkTypeface* onCreateFromStream(SkStreamAsset*, const SkFontParameter
s&) const; |
| 132 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const
= 0; | 137 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const
= 0; |
| 133 | 138 |
| 134 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], | 139 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], |
| 135 unsigned styleBits) const = 0; | 140 unsigned styleBits) const = 0; |
| 136 private: | 141 private: |
| 137 static SkFontMgr* Factory(); // implemented by porting layer | 142 static SkFontMgr* Factory(); // implemented by porting layer |
| 138 friend SkFontMgr* sk_fontmgr_create_default(); | 143 friend SkFontMgr* sk_fontmgr_create_default(); |
| 139 | 144 |
| 140 typedef SkRefCnt INHERITED; | 145 typedef SkRefCnt INHERITED; |
| 141 }; | 146 }; |
| 142 | 147 |
| 143 #endif | 148 #endif |
| OLD | NEW |