| 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 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 private: | 143 private: |
| 144 int fCollectionIndex; | 144 int fCollectionIndex; |
| 145 int fAxisCount; | 145 int fAxisCount; |
| 146 const Axis* fAxes; | 146 const Axis* fAxes; |
| 147 }; | 147 }; |
| 148 /* Experimental, API subject to change. */ | 148 /* Experimental, API subject to change. */ |
| 149 SkTypeface* createFromStream(SkStreamAsset*, const FontParameters&) const; | 149 SkTypeface* createFromStream(SkStreamAsset*, const FontParameters&) const; |
| 150 | 150 |
| 151 /** | 151 /** |
| 152 * Create a typeface from the specified font data. | 152 * Create a typeface from the specified font data. |
| 153 * Takes ownership of the font data, so the caller should not reference it
again. |
| 153 * Will return NULL if the typeface could not be created. | 154 * Will return NULL if the typeface could not be created. |
| 154 * The caller must call unref() on the returned object if it is not null. | 155 * The caller must call unref() on the returned object if it is not null. |
| 155 */ | 156 */ |
| 156 SkTypeface* createFromFontData(std::unique_ptr<SkFontData>) const; | 157 SkTypeface* createFromFontData(SkFontData*) const; |
| 157 | 158 |
| 158 /** | 159 /** |
| 159 * Create a typeface for the specified fileName and TTC index | 160 * Create a typeface for the specified fileName and TTC index |
| 160 * (pass 0 for none) or NULL if the file is not found, or its contents are | 161 * (pass 0 for none) or NULL if the file is not found, or its contents are |
| 161 * not recognized. The caller must call unref() on the returned object | 162 * not recognized. The caller must call unref() on the returned object |
| 162 * if it is not null. | 163 * if it is not null. |
| 163 */ | 164 */ |
| 164 SkTypeface* createFromFile(const char path[], int ttcIndex = 0) const; | 165 SkTypeface* createFromFile(const char path[], int ttcIndex = 0) const; |
| 165 | 166 |
| 166 SkTypeface* legacyCreateTypeface(const char familyName[], SkFontStyle style)
const; | 167 SkTypeface* legacyCreateTypeface(const char familyName[], SkFontStyle style)
const; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 184 virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], con
st SkFontStyle&, | 185 virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], con
st SkFontStyle&, |
| 185 const char* bcp47[], int bcp
47Count, | 186 const char* bcp47[], int bcp
47Count, |
| 186 SkUnichar character) const =
0; | 187 SkUnichar character) const =
0; |
| 187 virtual SkTypeface* onMatchFaceStyle(const SkTypeface*, | 188 virtual SkTypeface* onMatchFaceStyle(const SkTypeface*, |
| 188 const SkFontStyle&) const = 0; | 189 const SkFontStyle&) const = 0; |
| 189 | 190 |
| 190 virtual SkTypeface* onCreateFromData(SkData*, int ttcIndex) const = 0; | 191 virtual SkTypeface* onCreateFromData(SkData*, int ttcIndex) const = 0; |
| 191 virtual SkTypeface* onCreateFromStream(SkStreamAsset*, int ttcIndex) const =
0; | 192 virtual SkTypeface* onCreateFromStream(SkStreamAsset*, int ttcIndex) const =
0; |
| 192 // TODO: make pure virtual. | 193 // TODO: make pure virtual. |
| 193 virtual SkTypeface* onCreateFromStream(SkStreamAsset*, const FontParameters&
) const; | 194 virtual SkTypeface* onCreateFromStream(SkStreamAsset*, const FontParameters&
) const; |
| 194 virtual SkTypeface* onCreateFromFontData(std::unique_ptr<SkFontData>) const; | 195 virtual SkTypeface* onCreateFromFontData(SkFontData*) const; |
| 195 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const
= 0; | 196 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const
= 0; |
| 196 | 197 |
| 197 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontSt
yle) const = 0; | 198 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontSt
yle) const = 0; |
| 198 | 199 |
| 199 private: | 200 private: |
| 200 static SkFontMgr* Factory(); // implemented by porting layer | 201 static SkFontMgr* Factory(); // implemented by porting layer |
| 201 | 202 |
| 202 typedef SkRefCnt INHERITED; | 203 typedef SkRefCnt INHERITED; |
| 203 }; | 204 }; |
| 204 | 205 |
| 205 #endif | 206 #endif |
| OLD | NEW |