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 SkStream; |
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) |
| 22 |
21 virtual int count() = 0; | 23 virtual int count() = 0; |
22 virtual void getStyle(int index, SkFontStyle*, SkString* style) = 0; | 24 virtual void getStyle(int index, SkFontStyle*, SkString* style) = 0; |
23 virtual SkTypeface* createTypeface(int index) = 0; | 25 virtual SkTypeface* createTypeface(int index) = 0; |
24 virtual SkTypeface* matchStyle(const SkFontStyle& pattern) = 0; | 26 virtual SkTypeface* matchStyle(const SkFontStyle& pattern) = 0; |
25 | 27 |
26 static SkFontStyleSet* CreateEmpty(); | 28 static SkFontStyleSet* CreateEmpty(); |
| 29 |
| 30 private: |
| 31 typedef SkRefCnt INHERITED; |
27 }; | 32 }; |
28 | 33 |
29 class SK_API SkFontMgr : public SkRefCnt { | 34 class SK_API SkFontMgr : public SkRefCnt { |
30 public: | 35 public: |
| 36 SK_DECLARE_INST_COUNT(SkFontMgr) |
| 37 |
31 int countFamilies(); | 38 int countFamilies(); |
32 void getFamilyName(int index, SkString* familyName); | 39 void getFamilyName(int index, SkString* familyName); |
33 SkFontStyleSet* createStyleSet(int index); | 40 SkFontStyleSet* createStyleSet(int index); |
34 | 41 |
35 SkFontStyleSet* matchFamily(const char familyName[]); | 42 SkFontStyleSet* matchFamily(const char familyName[]); |
36 | 43 |
37 /** | 44 /** |
38 * Find the closest matching typeface to the specified familyName and style | 45 * Find the closest matching typeface to the specified familyName and style |
39 * and return a ref to it. The caller must call unref() on the returned | 46 * and return a ref to it. The caller must call unref() on the returned |
40 * object. Will never return NULL, as it will return the default font if | 47 * object. Will never return NULL, as it will return the default font if |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) = 0; | 96 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) = 0; |
90 | 97 |
91 private: | 98 private: |
92 static SkFontMgr* Factory(); // implemented by porting layer | 99 static SkFontMgr* Factory(); // implemented by porting layer |
93 static SkMutex* Mutex(); // implemented by porting layer | 100 static SkMutex* Mutex(); // implemented by porting layer |
94 | 101 |
95 typedef SkRefCnt INHERITED; | 102 typedef SkRefCnt INHERITED; |
96 }; | 103 }; |
97 | 104 |
98 #endif | 105 #endif |
OLD | NEW |