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

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

Issue 1027373002: Font variations. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Android and tests. Created 5 years, 7 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
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
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 SkStreamAsset; 16 class SkStreamAsset;
16 class SkString; 17 class SkString;
17 class SkTypeface; 18 class SkTypeface;
18 19
19 class SK_API SkFontStyleSet : public SkRefCnt { 20 class SK_API SkFontStyleSet : public SkRefCnt {
20 public: 21 public:
21 SK_DECLARE_INST_COUNT(SkFontStyleSet) 22 SK_DECLARE_INST_COUNT(SkFontStyleSet)
22 23
23 virtual int count() = 0; 24 virtual int count() = 0;
24 virtual void getStyle(int index, SkFontStyle*, SkString* style) = 0; 25 virtual void getStyle(int index, SkFontStyle*, SkString* style) = 0;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 * the returned object if it is not null. 87 * the returned object if it is not null.
87 */ 88 */
88 SkTypeface* createFromData(SkData*, int ttcIndex = 0) const; 89 SkTypeface* createFromData(SkData*, int ttcIndex = 0) const;
89 90
90 /** 91 /**
91 * Create a typeface for the specified stream and TTC index 92 * Create a typeface for the specified stream and TTC index
92 * (pass 0 for none) or NULL if the stream is not recognized. The caller 93 * (pass 0 for none) or NULL if the stream is not recognized. The caller
93 * must call unref() on the returned object if it is not null. 94 * must call unref() on the returned object if it is not null.
94 */ 95 */
95 SkTypeface* createFromStream(SkStreamAsset*, int ttcIndex = 0) const; 96 SkTypeface* createFromStream(SkStreamAsset*, int ttcIndex = 0) const;
97 SkTypeface* createFromFontData(SkFontData*) const;
reed1 2015/05/08 20:46:30 ownership of data?
96 98
97 /** 99 /**
98 * Create a typeface for the specified fileName and TTC index 100 * Create a typeface for the specified fileName and TTC index
99 * (pass 0 for none) or NULL if the file is not found, or its contents are 101 * (pass 0 for none) or NULL if the file is not found, or its contents are
100 * not recognized. The caller must call unref() on the returned object 102 * not recognized. The caller must call unref() on the returned object
101 * if it is not null. 103 * if it is not null.
102 */ 104 */
103 SkTypeface* createFromFile(const char path[], int ttcIndex = 0) const; 105 SkTypeface* createFromFile(const char path[], int ttcIndex = 0) const;
104 106
105 SkTypeface* legacyCreateTypeface(const char familyName[], 107 SkTypeface* legacyCreateTypeface(const char familyName[],
(...skipping 16 matching lines...) Expand all
122 virtual SkTypeface* onMatchFamilyStyle(const char familyName[], 124 virtual SkTypeface* onMatchFamilyStyle(const char familyName[],
123 const SkFontStyle&) const = 0; 125 const SkFontStyle&) const = 0;
124 virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], con st SkFontStyle&, 126 virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], con st SkFontStyle&,
125 const char* bcp47[], int bcp 47Count, 127 const char* bcp47[], int bcp 47Count,
126 SkUnichar character) const = 0; 128 SkUnichar character) const = 0;
127 virtual SkTypeface* onMatchFaceStyle(const SkTypeface*, 129 virtual SkTypeface* onMatchFaceStyle(const SkTypeface*,
128 const SkFontStyle&) const = 0; 130 const SkFontStyle&) const = 0;
129 131
130 virtual SkTypeface* onCreateFromData(SkData*, int ttcIndex) const = 0; 132 virtual SkTypeface* onCreateFromData(SkData*, int ttcIndex) const = 0;
131 virtual SkTypeface* onCreateFromStream(SkStreamAsset*, int ttcIndex) const = 0; 133 virtual SkTypeface* onCreateFromStream(SkStreamAsset*, int ttcIndex) const = 0;
134 // ThODO: make pure virtual.
135 virtual SkTypeface* onCreateFromFontData(SkFontData*) const;
132 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const = 0; 136 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const = 0;
133 137
134 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], 138 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[],
135 unsigned styleBits) const = 0; 139 unsigned styleBits) const = 0;
136 private: 140 private:
137 static SkFontMgr* Factory(); // implemented by porting layer 141 static SkFontMgr* Factory(); // implemented by porting layer
138 friend SkFontMgr* sk_fontmgr_create_default(); 142 friend SkFontMgr* sk_fontmgr_create_default();
139 143
140 typedef SkRefCnt INHERITED; 144 typedef SkRefCnt INHERITED;
141 }; 145 };
142 146
143 #endif 147 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698