Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: include/ports/SkFontMgr.h

Issue 21149008: refactoring for SK_FONTHOST_USES_FONTMGR option (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/core/SkTypeface.h ('k') | src/core/SkFontHost.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 13 matching lines...) Expand all
24 virtual void getStyle(int index, SkFontStyle*, SkString* style) = 0; 24 virtual void getStyle(int index, SkFontStyle*, SkString* style) = 0;
25 virtual SkTypeface* createTypeface(int index) = 0; 25 virtual SkTypeface* createTypeface(int index) = 0;
26 virtual SkTypeface* matchStyle(const SkFontStyle& pattern) = 0; 26 virtual SkTypeface* matchStyle(const SkFontStyle& pattern) = 0;
27 27
28 static SkFontStyleSet* CreateEmpty(); 28 static SkFontStyleSet* CreateEmpty();
29 29
30 private: 30 private:
31 typedef SkRefCnt INHERITED; 31 typedef SkRefCnt INHERITED;
32 }; 32 };
33 33
34 class SkTypeface;
35
34 class SK_API SkFontMgr : public SkRefCnt { 36 class SK_API SkFontMgr : public SkRefCnt {
35 public: 37 public:
36 SK_DECLARE_INST_COUNT(SkFontMgr) 38 SK_DECLARE_INST_COUNT(SkFontMgr)
37 39
38 int countFamilies(); 40 int countFamilies();
39 void getFamilyName(int index, SkString* familyName); 41 void getFamilyName(int index, SkString* familyName);
40 SkFontStyleSet* createStyleSet(int index); 42 SkFontStyleSet* createStyleSet(int index);
41 43
42 SkFontStyleSet* matchFamily(const char familyName[]); 44 SkFontStyleSet* matchFamily(const char familyName[]);
43 45
(...skipping 22 matching lines...) Expand all
66 SkTypeface* createFromStream(SkStream*, int ttcIndex = 0); 68 SkTypeface* createFromStream(SkStream*, int ttcIndex = 0);
67 69
68 /** 70 /**
69 * Create a typeface for the specified fileName and TTC index 71 * Create a typeface for the specified fileName and TTC index
70 * (pass 0 for none) or NULL if the file is not found, or its contents are 72 * (pass 0 for none) or NULL if the file is not found, or its contents are
71 * not recognized. The caller must call unref() on the returned object 73 * not recognized. The caller must call unref() on the returned object
72 * if it is not null. 74 * if it is not null.
73 */ 75 */
74 SkTypeface* createFromFile(const char path[], int ttcIndex = 0); 76 SkTypeface* createFromFile(const char path[], int ttcIndex = 0);
75 77
78 SkTypeface* legacyCreateTypeface(const char familyName[],
79 unsigned typefaceStyleBits);
80
76 /** 81 /**
77 * Return a ref to the default fontmgr. The caller must call unref() on 82 * Return a ref to the default fontmgr. The caller must call unref() on
78 * the returned object. 83 * the returned object.
79 */ 84 */
80 static SkFontMgr* RefDefault(); 85 static SkFontMgr* RefDefault();
81 86
82 protected: 87 protected:
83 virtual int onCountFamilies() = 0; 88 virtual int onCountFamilies() = 0;
84 virtual void onGetFamilyName(int index, SkString* familyName) = 0; 89 virtual void onGetFamilyName(int index, SkString* familyName) = 0;
85 virtual SkFontStyleSet* onCreateStyleSet(int index) = 0; 90 virtual SkFontStyleSet* onCreateStyleSet(int index) = 0;
86 91
87 virtual SkFontStyleSet* onMatchFamily(const char familyName[]) = 0; 92 virtual SkFontStyleSet* onMatchFamily(const char familyName[]) = 0;
88 93
89 virtual SkTypeface* onMatchFamilyStyle(const char familyName[], 94 virtual SkTypeface* onMatchFamilyStyle(const char familyName[],
90 const SkFontStyle&) = 0; 95 const SkFontStyle&) = 0;
91 virtual SkTypeface* onMatchFaceStyle(const SkTypeface*, 96 virtual SkTypeface* onMatchFaceStyle(const SkTypeface*,
92 const SkFontStyle&) = 0; 97 const SkFontStyle&) = 0;
93 98
94 virtual SkTypeface* onCreateFromData(SkData*, int ttcIndex) = 0; 99 virtual SkTypeface* onCreateFromData(SkData*, int ttcIndex) = 0;
95 virtual SkTypeface* onCreateFromStream(SkStream*, int ttcIndex) = 0; 100 virtual SkTypeface* onCreateFromStream(SkStream*, int ttcIndex) = 0;
96 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) = 0; 101 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) = 0;
97 102
103 // TODO: make this pure-virtual once all ports know about it
104 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[],
105 unsigned styleBits);
98 private: 106 private:
99 static SkFontMgr* Factory(); // implemented by porting layer 107 static SkFontMgr* Factory(); // implemented by porting layer
100 108
101 typedef SkRefCnt INHERITED; 109 typedef SkRefCnt INHERITED;
102 }; 110 };
103 111
104 #endif 112 #endif
OLDNEW
« no previous file with comments | « include/core/SkTypeface.h ('k') | src/core/SkFontHost.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698