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 SkFontData; | 15 class SkFontData; |
16 class SkStreamAsset; | 16 class SkStreamAsset; |
17 class SkString; | 17 class SkString; |
18 class SkTypeface; | 18 class SkTypeface; |
19 | 19 |
20 class SK_API SkFontStyleSet : public SkRefCnt { | 20 class SK_API SkFontStyleSet : public SkRefCnt { |
21 public: | 21 public: |
22 SK_DECLARE_INST_COUNT(SkFontStyleSet) | 22 |
23 | 23 |
24 virtual int count() = 0; | 24 virtual int count() = 0; |
25 virtual void getStyle(int index, SkFontStyle*, SkString* style) = 0; | 25 virtual void getStyle(int index, SkFontStyle*, SkString* style) = 0; |
26 virtual SkTypeface* createTypeface(int index) = 0; | 26 virtual SkTypeface* createTypeface(int index) = 0; |
27 virtual SkTypeface* matchStyle(const SkFontStyle& pattern) = 0; | 27 virtual SkTypeface* matchStyle(const SkFontStyle& pattern) = 0; |
28 | 28 |
29 static SkFontStyleSet* CreateEmpty(); | 29 static SkFontStyleSet* CreateEmpty(); |
30 | 30 |
31 private: | 31 private: |
32 typedef SkRefCnt INHERITED; | 32 typedef SkRefCnt INHERITED; |
33 }; | 33 }; |
34 | 34 |
35 class SkTypeface; | 35 class SkTypeface; |
36 | 36 |
37 class SK_API SkFontMgr : public SkRefCnt { | 37 class SK_API SkFontMgr : public SkRefCnt { |
38 public: | 38 public: |
39 SK_DECLARE_INST_COUNT(SkFontMgr) | 39 |
40 | 40 |
41 int countFamilies() const; | 41 int countFamilies() const; |
42 void getFamilyName(int index, SkString* familyName) const; | 42 void getFamilyName(int index, SkString* familyName) const; |
43 SkFontStyleSet* createStyleSet(int index) const; | 43 SkFontStyleSet* createStyleSet(int index) const; |
44 | 44 |
45 /** | 45 /** |
46 * The caller must call unref() on the returned object. | 46 * The caller must call unref() on the returned object. |
47 * Never returns NULL; will return an empty set if the name is not found. | 47 * Never returns NULL; will return an empty set if the name is not found. |
48 * | 48 * |
49 * It is possible that this will return a style set not accessible from | 49 * It is possible that this will return a style set not accessible from |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], | 145 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], |
146 unsigned styleBits) const = 0; | 146 unsigned styleBits) const = 0; |
147 private: | 147 private: |
148 static SkFontMgr* Factory(); // implemented by porting layer | 148 static SkFontMgr* Factory(); // implemented by porting layer |
149 friend SkFontMgr* sk_fontmgr_create_default(); | 149 friend SkFontMgr* sk_fontmgr_create_default(); |
150 | 150 |
151 typedef SkRefCnt INHERITED; | 151 typedef SkRefCnt INHERITED; |
152 }; | 152 }; |
153 | 153 |
154 #endif | 154 #endif |
OLD | NEW |