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 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 * no matching font is found. | 57 * no matching font is found. |
58 * | 58 * |
59 * It is possible that this will return a style set not accessible from | 59 * It is possible that this will return a style set not accessible from |
60 * createStyleSet(int) or matchFamily(const char[]) due to hidden or | 60 * createStyleSet(int) or matchFamily(const char[]) due to hidden or |
61 * auto-activated fonts. | 61 * auto-activated fonts. |
62 */ | 62 */ |
63 SkTypeface* matchFamilyStyle(const char familyName[], const SkFontStyle&) co
nst; | 63 SkTypeface* matchFamilyStyle(const char familyName[], const SkFontStyle&) co
nst; |
64 | 64 |
65 /** | 65 /** |
66 * Use the system fallback to find a typeface for the given character. | 66 * Use the system fallback to find a typeface for the given character. |
67 * Note that bpc47 is a combination of ISO 639, 15924, and 3166-1 codes, | 67 * Note that bcp47 is a combination of ISO 639, 15924, and 3166-1 codes, |
68 * so it is fine to just pass a ISO 639 here. | 68 * so it is fine to just pass a ISO 639 here. |
69 * | 69 * |
70 * Will return NULL if no family can be found for the character | 70 * Will return NULL if no family can be found for the character |
71 * in the system fallback. | 71 * in the system fallback. |
72 */ | 72 */ |
73 SkTypeface* matchFamilyStyleCharacter(const char familyName[], const SkFontS
tyle&, | 73 SkTypeface* matchFamilyStyleCharacter(const char familyName[], const SkFontS
tyle&, |
74 const char bpc47[], uint32_t character
) const; | 74 const char* bcp47[], int bcpLength, |
| 75 SkUnichar character) const; |
75 | 76 |
76 SkTypeface* matchFaceStyle(const SkTypeface*, const SkFontStyle&) const; | 77 SkTypeface* matchFaceStyle(const SkTypeface*, const SkFontStyle&) const; |
77 | 78 |
78 /** | 79 /** |
79 * Create a typeface for the specified data and TTC index (pass 0 for none) | 80 * Create a typeface for the specified data and TTC index (pass 0 for none) |
80 * or NULL if the data is not recognized. The caller must call unref() on | 81 * or NULL if the data is not recognized. The caller must call unref() on |
81 * the returned object if it is not null. | 82 * the returned object if it is not null. |
82 */ | 83 */ |
83 SkTypeface* createFromData(SkData*, int ttcIndex = 0) const; | 84 SkTypeface* createFromData(SkData*, int ttcIndex = 0) const; |
84 | 85 |
(...skipping 26 matching lines...) Expand all Loading... |
111 virtual void onGetFamilyName(int index, SkString* familyName) const = 0; | 112 virtual void onGetFamilyName(int index, SkString* familyName) const = 0; |
112 virtual SkFontStyleSet* onCreateStyleSet(int index)const = 0; | 113 virtual SkFontStyleSet* onCreateStyleSet(int index)const = 0; |
113 | 114 |
114 /** May return NULL if the name is not found. */ | 115 /** May return NULL if the name is not found. */ |
115 virtual SkFontStyleSet* onMatchFamily(const char familyName[]) const = 0; | 116 virtual SkFontStyleSet* onMatchFamily(const char familyName[]) const = 0; |
116 | 117 |
117 virtual SkTypeface* onMatchFamilyStyle(const char familyName[], | 118 virtual SkTypeface* onMatchFamilyStyle(const char familyName[], |
118 const SkFontStyle&) const = 0; | 119 const SkFontStyle&) const = 0; |
119 // TODO: pure virtual, implement on all impls. | 120 // TODO: pure virtual, implement on all impls. |
120 virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], con
st SkFontStyle&, | 121 virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], con
st SkFontStyle&, |
121 const char bpc47[], uint32_t
character) const | 122 const char* bcp47[], int bcp
Length, |
| 123 SkUnichar character) const |
122 { return NULL; } | 124 { return NULL; } |
123 virtual SkTypeface* onMatchFaceStyle(const SkTypeface*, | 125 virtual SkTypeface* onMatchFaceStyle(const SkTypeface*, |
124 const SkFontStyle&) const = 0; | 126 const SkFontStyle&) const = 0; |
125 | 127 |
126 virtual SkTypeface* onCreateFromData(SkData*, int ttcIndex) const = 0; | 128 virtual SkTypeface* onCreateFromData(SkData*, int ttcIndex) const = 0; |
127 virtual SkTypeface* onCreateFromStream(SkStream*, int ttcIndex) const = 0; | 129 virtual SkTypeface* onCreateFromStream(SkStream*, int ttcIndex) const = 0; |
128 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const
= 0; | 130 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const
= 0; |
129 | 131 |
130 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], | 132 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], |
131 unsigned styleBits) const = 0; | 133 unsigned styleBits) const = 0; |
132 private: | 134 private: |
133 static SkFontMgr* Factory(); // implemented by porting layer | 135 static SkFontMgr* Factory(); // implemented by porting layer |
134 friend SkFontMgr* sk_fontmgr_create_default(); | 136 friend SkFontMgr* sk_fontmgr_create_default(); |
135 | 137 |
136 typedef SkRefCnt INHERITED; | 138 typedef SkRefCnt INHERITED; |
137 }; | 139 }; |
138 | 140 |
139 #endif | 141 #endif |
OLD | NEW |