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

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

Issue 1128913008: Revert of Font variations. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
« no previous file with comments | « include/core/SkTypeface.h ('k') | resources/android_fonts/v22/fonts.xml » ('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
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;
16 class SkStreamAsset; 15 class SkStreamAsset;
17 class SkString; 16 class SkString;
18 class SkTypeface; 17 class SkTypeface;
19 18
20 class SK_API SkFontStyleSet : public SkRefCnt { 19 class SK_API SkFontStyleSet : public SkRefCnt {
21 public: 20 public:
22 SK_DECLARE_INST_COUNT(SkFontStyleSet) 21 SK_DECLARE_INST_COUNT(SkFontStyleSet)
23 22
24 virtual int count() = 0; 23 virtual int count() = 0;
25 virtual void getStyle(int index, SkFontStyle*, SkString* style) = 0; 24 virtual void getStyle(int index, SkFontStyle*, SkString* style) = 0;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 SkTypeface* createFromData(SkData*, int ttcIndex = 0) const; 88 SkTypeface* createFromData(SkData*, int ttcIndex = 0) const;
90 89
91 /** 90 /**
92 * Create a typeface for the specified stream and TTC index 91 * Create a typeface for the specified stream and TTC index
93 * (pass 0 for none) or NULL if the stream is not recognized. The caller 92 * (pass 0 for none) or NULL if the stream is not recognized. The caller
94 * must call unref() on the returned object if it is not null. 93 * must call unref() on the returned object if it is not null.
95 */ 94 */
96 SkTypeface* createFromStream(SkStreamAsset*, int ttcIndex = 0) const; 95 SkTypeface* createFromStream(SkStreamAsset*, int ttcIndex = 0) const;
97 96
98 /** 97 /**
99 * Create a typeface from the specified font data.
100 * Takes ownership of the font data, so the caller should not reference it again.
101 * Will return NULL if the typeface could not be created.
102 * The caller must call unref() on the returned object if it is not null.
103 */
104 SkTypeface* createFromFontData(SkFontData*) const;
105
106 /**
107 * Create a typeface for the specified fileName and TTC index 98 * Create a typeface for the specified fileName and TTC index
108 * (pass 0 for none) or NULL if the file is not found, or its contents are 99 * (pass 0 for none) or NULL if the file is not found, or its contents are
109 * not recognized. The caller must call unref() on the returned object 100 * not recognized. The caller must call unref() on the returned object
110 * if it is not null. 101 * if it is not null.
111 */ 102 */
112 SkTypeface* createFromFile(const char path[], int ttcIndex = 0) const; 103 SkTypeface* createFromFile(const char path[], int ttcIndex = 0) const;
113 104
114 SkTypeface* legacyCreateTypeface(const char familyName[], 105 SkTypeface* legacyCreateTypeface(const char familyName[],
115 unsigned typefaceStyleBits) const; 106 unsigned typefaceStyleBits) const;
116 107
(...skipping 14 matching lines...) Expand all
131 virtual SkTypeface* onMatchFamilyStyle(const char familyName[], 122 virtual SkTypeface* onMatchFamilyStyle(const char familyName[],
132 const SkFontStyle&) const = 0; 123 const SkFontStyle&) const = 0;
133 virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], con st SkFontStyle&, 124 virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], con st SkFontStyle&,
134 const char* bcp47[], int bcp 47Count, 125 const char* bcp47[], int bcp 47Count,
135 SkUnichar character) const = 0; 126 SkUnichar character) const = 0;
136 virtual SkTypeface* onMatchFaceStyle(const SkTypeface*, 127 virtual SkTypeface* onMatchFaceStyle(const SkTypeface*,
137 const SkFontStyle&) const = 0; 128 const SkFontStyle&) const = 0;
138 129
139 virtual SkTypeface* onCreateFromData(SkData*, int ttcIndex) const = 0; 130 virtual SkTypeface* onCreateFromData(SkData*, int ttcIndex) const = 0;
140 virtual SkTypeface* onCreateFromStream(SkStreamAsset*, int ttcIndex) const = 0; 131 virtual SkTypeface* onCreateFromStream(SkStreamAsset*, int ttcIndex) const = 0;
141 // TODO: make pure virtual.
142 virtual SkTypeface* onCreateFromFontData(SkFontData*) const;
143 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const = 0; 132 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const = 0;
144 133
145 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], 134 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[],
146 unsigned styleBits) const = 0; 135 unsigned styleBits) const = 0;
147 private: 136 private:
148 static SkFontMgr* Factory(); // implemented by porting layer 137 static SkFontMgr* Factory(); // implemented by porting layer
149 friend SkFontMgr* sk_fontmgr_create_default(); 138 friend SkFontMgr* sk_fontmgr_create_default();
150 139
151 typedef SkRefCnt INHERITED; 140 typedef SkRefCnt INHERITED;
152 }; 141 };
153 142
154 #endif 143 #endif
OLDNEW
« no previous file with comments | « include/core/SkTypeface.h ('k') | resources/android_fonts/v22/fonts.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698