OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 #include "SkFontDescriptor.h" | 8 #include "SkFontDescriptor.h" |
9 #include "SkFontHost_FreeType_common.h" | 9 #include "SkFontHost_FreeType_common.h" |
10 #include "SkFontMgr.h" | 10 #include "SkFontMgr.h" |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 for (int j = 0; j < fFamilies[i]->fStyles.count(); ++j) { | 254 for (int j = 0; j < fFamilies[i]->fStyles.count(); ++j) { |
255 if (fFamilies[i]->fStyles[j].get() == familyMember) { | 255 if (fFamilies[i]->fStyles[j].get() == familyMember) { |
256 return fFamilies[i]->matchStyle(fontStyle); | 256 return fFamilies[i]->matchStyle(fontStyle); |
257 } | 257 } |
258 } | 258 } |
259 } | 259 } |
260 return nullptr; | 260 return nullptr; |
261 } | 261 } |
262 | 262 |
263 SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override { | 263 SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override { |
264 return this->createFromStream(new SkMemoryStream(data), ttcIndex); | 264 return this->createFromStream(new SkMemoryStream(sk_ref_sp(data)), ttcIn
dex); |
265 } | 265 } |
266 | 266 |
267 SkTypeface* onCreateFromStream(SkStreamAsset* bareStream, int ttcIndex) cons
t override { | 267 SkTypeface* onCreateFromStream(SkStreamAsset* bareStream, int ttcIndex) cons
t override { |
268 return this->createFromStream(bareStream, FontParameters().setCollection
Index(ttcIndex)); | 268 return this->createFromStream(bareStream, FontParameters().setCollection
Index(ttcIndex)); |
269 } | 269 } |
270 | 270 |
271 SkTypeface* onCreateFromStream(SkStreamAsset* s, const FontParameters& param
s) const override { | 271 SkTypeface* onCreateFromStream(SkStreamAsset* s, const FontParameters& param
s) const override { |
272 using Scanner = SkTypeface_FreeType::Scanner; | 272 using Scanner = SkTypeface_FreeType::Scanner; |
273 SkAutoTDelete<SkStreamAsset> stream(s); | 273 SkAutoTDelete<SkStreamAsset> stream(s); |
274 bool isFixedPitch; | 274 bool isFixedPitch; |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 SkFontStyleSet_Custom* family = new SkFontStyleSet_Custom(SkString()); | 511 SkFontStyleSet_Custom* family = new SkFontStyleSet_Custom(SkString()); |
512 families->push_back().reset(family); | 512 families->push_back().reset(family); |
513 family->appendTypeface(sk_make_sp<SkTypeface_Empty>()); | 513 family->appendTypeface(sk_make_sp<SkTypeface_Empty>()); |
514 } | 514 } |
515 | 515 |
516 }; | 516 }; |
517 | 517 |
518 SK_API SkFontMgr* SkFontMgr_New_Custom_Empty() { | 518 SK_API SkFontMgr* SkFontMgr_New_Custom_Empty() { |
519 return new SkFontMgr_Custom(EmptyFontLoader()); | 519 return new SkFontMgr_Custom(EmptyFontLoader()); |
520 } | 520 } |
OLD | NEW |