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 SkStream; | 15 class SkStreamAsset; |
16 class SkString; | 16 class SkString; |
17 class SkTypeface; | 17 class SkTypeface; |
18 | 18 |
19 class SK_API SkFontStyleSet : public SkRefCnt { | 19 class SK_API SkFontStyleSet : public SkRefCnt { |
20 public: | 20 public: |
21 SK_DECLARE_INST_COUNT(SkFontStyleSet) | 21 SK_DECLARE_INST_COUNT(SkFontStyleSet) |
22 | 22 |
23 virtual int count() = 0; | 23 virtual int count() = 0; |
24 virtual void getStyle(int index, SkFontStyle*, SkString* style) = 0; | 24 virtual void getStyle(int index, SkFontStyle*, SkString* style) = 0; |
25 virtual SkTypeface* createTypeface(int index) = 0; | 25 virtual SkTypeface* createTypeface(int index) = 0; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 * or NULL if the data is not recognized. The caller must call unref() on | 85 * or NULL if the data is not recognized. The caller must call unref() on |
86 * the returned object if it is not null. | 86 * the returned object if it is not null. |
87 */ | 87 */ |
88 SkTypeface* createFromData(SkData*, int ttcIndex = 0) const; | 88 SkTypeface* createFromData(SkData*, int ttcIndex = 0) const; |
89 | 89 |
90 /** | 90 /** |
91 * Create a typeface for the specified stream and TTC index | 91 * Create a typeface for the specified stream and TTC index |
92 * (pass 0 for none) or NULL if the stream is not recognized. The caller | 92 * (pass 0 for none) or NULL if the stream is not recognized. The caller |
93 * must call unref() on the returned object if it is not null. | 93 * must call unref() on the returned object if it is not null. |
94 */ | 94 */ |
95 SkTypeface* createFromStream(SkStream*, int ttcIndex = 0) const; | 95 SkTypeface* createFromStream(SkStreamAsset*, int ttcIndex = 0) const; |
96 | 96 |
97 /** | 97 /** |
98 * Create a typeface for the specified fileName and TTC index | 98 * Create a typeface for the specified fileName and TTC index |
99 * (pass 0 for none) or NULL if the file is not found, or its contents are | 99 * (pass 0 for none) or NULL if the file is not found, or its contents are |
100 * not recognized. The caller must call unref() on the returned object | 100 * not recognized. The caller must call unref() on the returned object |
101 * if it is not null. | 101 * if it is not null. |
102 */ | 102 */ |
103 SkTypeface* createFromFile(const char path[], int ttcIndex = 0) const; | 103 SkTypeface* createFromFile(const char path[], int ttcIndex = 0) const; |
104 | 104 |
105 SkTypeface* legacyCreateTypeface(const char familyName[], | 105 SkTypeface* legacyCreateTypeface(const char familyName[], |
(...skipping 15 matching lines...) Expand all Loading... |
121 | 121 |
122 virtual SkTypeface* onMatchFamilyStyle(const char familyName[], | 122 virtual SkTypeface* onMatchFamilyStyle(const char familyName[], |
123 const SkFontStyle&) const = 0; | 123 const SkFontStyle&) const = 0; |
124 virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], con
st SkFontStyle&, | 124 virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], con
st SkFontStyle&, |
125 const char* bcp47[], int bcp
47Count, | 125 const char* bcp47[], int bcp
47Count, |
126 SkUnichar character) const =
0; | 126 SkUnichar character) const =
0; |
127 virtual SkTypeface* onMatchFaceStyle(const SkTypeface*, | 127 virtual SkTypeface* onMatchFaceStyle(const SkTypeface*, |
128 const SkFontStyle&) const = 0; | 128 const SkFontStyle&) const = 0; |
129 | 129 |
130 virtual SkTypeface* onCreateFromData(SkData*, int ttcIndex) const = 0; | 130 virtual SkTypeface* onCreateFromData(SkData*, int ttcIndex) const = 0; |
131 virtual SkTypeface* onCreateFromStream(SkStream*, int ttcIndex) const = 0; | 131 virtual SkTypeface* onCreateFromStream(SkStreamAsset*, int ttcIndex) const =
0; |
132 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const
= 0; | 132 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const
= 0; |
133 | 133 |
134 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], | 134 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], |
135 unsigned styleBits) const = 0; | 135 unsigned styleBits) const = 0; |
136 private: | 136 private: |
137 static SkFontMgr* Factory(); // implemented by porting layer | 137 static SkFontMgr* Factory(); // implemented by porting layer |
138 friend SkFontMgr* sk_fontmgr_create_default(); | 138 friend SkFontMgr* sk_fontmgr_create_default(); |
139 | 139 |
140 typedef SkRefCnt INHERITED; | 140 typedef SkRefCnt INHERITED; |
141 }; | 141 }; |
142 | 142 |
143 #endif | 143 #endif |
OLD | NEW |