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