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 25 matching lines...) Expand all Loading... |
36 class SK_API SkFontMgr : public SkRefCnt { | 36 class SK_API SkFontMgr : public SkRefCnt { |
37 public: | 37 public: |
38 int countFamilies() const; | 38 int countFamilies() const; |
39 void getFamilyName(int index, SkString* familyName) const; | 39 void getFamilyName(int index, SkString* familyName) const; |
40 SkFontStyleSet* createStyleSet(int index) const; | 40 SkFontStyleSet* createStyleSet(int index) const; |
41 | 41 |
42 /** | 42 /** |
43 * The caller must call unref() on the returned object. | 43 * The caller must call unref() on the returned object. |
44 * Never returns NULL; will return an empty set if the name is not found. | 44 * Never returns NULL; will return an empty set if the name is not found. |
45 * | 45 * |
| 46 * Passing |nullptr| as the parameter will return the default system font. |
| 47 * |
46 * It is possible that this will return a style set not accessible from | 48 * It is possible that this will return a style set not accessible from |
47 * createStyleSet(int) due to hidden or auto-activated fonts. | 49 * createStyleSet(int) due to hidden or auto-activated fonts. |
48 */ | 50 */ |
49 SkFontStyleSet* matchFamily(const char familyName[]) const; | 51 SkFontStyleSet* matchFamily(const char familyName[]) const; |
50 | 52 |
51 /** | 53 /** |
52 * Find the closest matching typeface to the specified familyName and style | 54 * Find the closest matching typeface to the specified familyName and style |
53 * and return a ref to it. The caller must call unref() on the returned | 55 * and return a ref to it. The caller must call unref() on the returned |
54 * object. Will never return NULL, as it will return the default font if | 56 * object. Will never return NULL, as it will return the default font if |
55 * no matching font is found. | 57 * no matching font is found. |
56 * | 58 * |
| 59 * Passing |nullptr| as the parameter for |familyName| will return the |
| 60 * default system font. |
| 61 * |
57 * It is possible that this will return a style set not accessible from | 62 * It is possible that this will return a style set not accessible from |
58 * createStyleSet(int) or matchFamily(const char[]) due to hidden or | 63 * createStyleSet(int) or matchFamily(const char[]) due to hidden or |
59 * auto-activated fonts. | 64 * auto-activated fonts. |
60 */ | 65 */ |
61 SkTypeface* matchFamilyStyle(const char familyName[], const SkFontStyle&) co
nst; | 66 SkTypeface* matchFamilyStyle(const char familyName[], const SkFontStyle&) co
nst; |
62 | 67 |
63 /** | 68 /** |
64 * Use the system fallback to find a typeface for the given character. | 69 * Use the system fallback to find a typeface for the given character. |
65 * Note that bcp47 is a combination of ISO 639, 15924, and 3166-1 codes, | 70 * Note that bcp47 is a combination of ISO 639, 15924, and 3166-1 codes, |
66 * so it is fine to just pass a ISO 639 here. | 71 * so it is fine to just pass a ISO 639 here. |
67 * | 72 * |
68 * Will return NULL if no family can be found for the character | 73 * Will return NULL if no family can be found for the character |
69 * in the system fallback. | 74 * in the system fallback. |
70 * | 75 * |
| 76 * Passing |nullptr| as the parameter for |familyName| will return the |
| 77 * default system font. |
| 78 * |
71 * bcp47[0] is the least significant fallback, bcp47[bcp47Count-1] is the | 79 * bcp47[0] is the least significant fallback, bcp47[bcp47Count-1] is the |
72 * most significant. If no specified bcp47 codes match, any font with the | 80 * most significant. If no specified bcp47 codes match, any font with the |
73 * requested character will be matched. | 81 * requested character will be matched. |
74 */ | 82 */ |
75 SkTypeface* matchFamilyStyleCharacter(const char familyName[], const SkFontS
tyle&, | 83 SkTypeface* matchFamilyStyleCharacter(const char familyName[], const SkFontS
tyle&, |
76 const char* bcp47[], int bcp47Count, | 84 const char* bcp47[], int bcp47Count, |
77 SkUnichar character) const; | 85 SkUnichar character) const; |
78 | 86 |
79 SkTypeface* matchFaceStyle(const SkTypeface*, const SkFontStyle&) const; | 87 SkTypeface* matchFaceStyle(const SkTypeface*, const SkFontStyle&) const; |
80 | 88 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], | 150 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], |
143 unsigned styleBits) const = 0; | 151 unsigned styleBits) const = 0; |
144 private: | 152 private: |
145 static SkFontMgr* Factory(); // implemented by porting layer | 153 static SkFontMgr* Factory(); // implemented by porting layer |
146 friend SkFontMgr* sk_fontmgr_create_default(); | 154 friend SkFontMgr* sk_fontmgr_create_default(); |
147 | 155 |
148 typedef SkRefCnt INHERITED; | 156 typedef SkRefCnt INHERITED; |
149 }; | 157 }; |
150 | 158 |
151 #endif | 159 #endif |
OLD | NEW |