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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 } else { | 301 } else { |
302 return nullptr; | 302 return nullptr; |
303 } | 303 } |
304 } | 304 } |
305 | 305 |
306 SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override
{ | 306 SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override
{ |
307 SkAutoTDelete<SkStreamAsset> stream(SkStream::NewFromFile(path)); | 307 SkAutoTDelete<SkStreamAsset> stream(SkStream::NewFromFile(path)); |
308 return stream.get() ? this->createFromStream(stream.release(), ttcIndex)
: nullptr; | 308 return stream.get() ? this->createFromStream(stream.release(), ttcIndex)
: nullptr; |
309 } | 309 } |
310 | 310 |
311 #ifdef SK_VERY_LEGACY_CREATE_TYPEFACE | |
312 SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBi
ts) const override { | |
313 SkFontStyle style = SkFontStyle::FromOldStyle(styleBits); | |
314 #else | |
315 SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle styl
e) const override { | 311 SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle styl
e) const override { |
316 #endif | |
317 SkTypeface* tf = nullptr; | 312 SkTypeface* tf = nullptr; |
318 | 313 |
319 if (familyName) { | 314 if (familyName) { |
320 tf = this->onMatchFamilyStyle(familyName, style); | 315 tf = this->onMatchFamilyStyle(familyName, style); |
321 } | 316 } |
322 | 317 |
323 if (nullptr == tf) { | 318 if (nullptr == tf) { |
324 tf = fDefaultFamily->matchStyle(style); | 319 tf = fDefaultFamily->matchStyle(style); |
325 } | 320 } |
326 | 321 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 SkFontStyleSet_Custom* family = new SkFontStyleSet_Custom(SkString()); | 511 SkFontStyleSet_Custom* family = new SkFontStyleSet_Custom(SkString()); |
517 families->push_back().reset(family); | 512 families->push_back().reset(family); |
518 family->appendTypeface(new SkTypeface_Empty); | 513 family->appendTypeface(new SkTypeface_Empty); |
519 } | 514 } |
520 | 515 |
521 }; | 516 }; |
522 | 517 |
523 SK_API SkFontMgr* SkFontMgr_New_Custom_Empty() { | 518 SK_API SkFontMgr* SkFontMgr_New_Custom_Empty() { |
524 return new SkFontMgr_Custom(EmptyFontLoader()); | 519 return new SkFontMgr_Custom(EmptyFontLoader()); |
525 } | 520 } |
OLD | NEW |