| 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 * |
| 73 * bcp47[0] is the least significant fallback, bcp47[bcp47Count-1] is the |
| 74 * most significant. If no specified bcp47 codes match, any font with the |
| 75 * requested character will be matched. |
| 72 */ | 76 */ |
| 77 #ifdef SK_FM_NEW_MATCH_FAMILY_STYLE_CHARACTER |
| 73 SkTypeface* matchFamilyStyleCharacter(const char familyName[], const SkFontS
tyle&, | 78 SkTypeface* matchFamilyStyleCharacter(const char familyName[], const SkFontS
tyle&, |
| 74 const char bpc47[], uint32_t character
) const; | 79 const char* bcp47[], int bcp47Count, |
| 80 SkUnichar character) const; |
| 81 #else |
| 82 SkTypeface* matchFamilyStyleCharacter(const char familyName[], const SkFontS
tyle&, |
| 83 const char bcp47[], SkUnichar characte
r) const; |
| 84 #endif |
| 75 | 85 |
| 76 SkTypeface* matchFaceStyle(const SkTypeface*, const SkFontStyle&) const; | 86 SkTypeface* matchFaceStyle(const SkTypeface*, const SkFontStyle&) const; |
| 77 | 87 |
| 78 /** | 88 /** |
| 79 * Create a typeface for the specified data and TTC index (pass 0 for none) | 89 * 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 | 90 * or NULL if the data is not recognized. The caller must call unref() on |
| 81 * the returned object if it is not null. | 91 * the returned object if it is not null. |
| 82 */ | 92 */ |
| 83 SkTypeface* createFromData(SkData*, int ttcIndex = 0) const; | 93 SkTypeface* createFromData(SkData*, int ttcIndex = 0) const; |
| 84 | 94 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 110 virtual int onCountFamilies() const = 0; | 120 virtual int onCountFamilies() const = 0; |
| 111 virtual void onGetFamilyName(int index, SkString* familyName) const = 0; | 121 virtual void onGetFamilyName(int index, SkString* familyName) const = 0; |
| 112 virtual SkFontStyleSet* onCreateStyleSet(int index)const = 0; | 122 virtual SkFontStyleSet* onCreateStyleSet(int index)const = 0; |
| 113 | 123 |
| 114 /** May return NULL if the name is not found. */ | 124 /** May return NULL if the name is not found. */ |
| 115 virtual SkFontStyleSet* onMatchFamily(const char familyName[]) const = 0; | 125 virtual SkFontStyleSet* onMatchFamily(const char familyName[]) const = 0; |
| 116 | 126 |
| 117 virtual SkTypeface* onMatchFamilyStyle(const char familyName[], | 127 virtual SkTypeface* onMatchFamilyStyle(const char familyName[], |
| 118 const SkFontStyle&) const = 0; | 128 const SkFontStyle&) const = 0; |
| 119 // TODO: pure virtual, implement on all impls. | 129 // TODO: pure virtual, implement on all impls. |
| 130 #ifdef SK_FM_NEW_MATCH_FAMILY_STYLE_CHARACTER |
| 120 virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], con
st SkFontStyle&, | 131 virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], con
st SkFontStyle&, |
| 121 const char bpc47[], uint32_t
character) const | 132 const char* bcp47[], int bcp
47Count, |
| 133 SkUnichar character) const |
| 134 #else |
| 135 virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], con
st SkFontStyle&, |
| 136 const char bcp47[], SkUnicha
r character) const |
| 137 #endif |
| 122 { return NULL; } | 138 { return NULL; } |
| 123 virtual SkTypeface* onMatchFaceStyle(const SkTypeface*, | 139 virtual SkTypeface* onMatchFaceStyle(const SkTypeface*, |
| 124 const SkFontStyle&) const = 0; | 140 const SkFontStyle&) const = 0; |
| 125 | 141 |
| 126 virtual SkTypeface* onCreateFromData(SkData*, int ttcIndex) const = 0; | 142 virtual SkTypeface* onCreateFromData(SkData*, int ttcIndex) const = 0; |
| 127 virtual SkTypeface* onCreateFromStream(SkStream*, int ttcIndex) const = 0; | 143 virtual SkTypeface* onCreateFromStream(SkStream*, int ttcIndex) const = 0; |
| 128 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const
= 0; | 144 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const
= 0; |
| 129 | 145 |
| 130 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], | 146 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], |
| 131 unsigned styleBits) const = 0; | 147 unsigned styleBits) const = 0; |
| 132 private: | 148 private: |
| 133 static SkFontMgr* Factory(); // implemented by porting layer | 149 static SkFontMgr* Factory(); // implemented by porting layer |
| 134 friend SkFontMgr* sk_fontmgr_create_default(); | 150 friend SkFontMgr* sk_fontmgr_create_default(); |
| 135 | 151 |
| 136 typedef SkRefCnt INHERITED; | 152 typedef SkRefCnt INHERITED; |
| 137 }; | 153 }; |
| 138 | 154 |
| 139 #endif | 155 #endif |
| OLD | NEW |