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 |
311 SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBi
ts) const override { | 312 SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBi
ts) const override { |
312 SkTypeface::Style oldStyle = (SkTypeface::Style)styleBits; | 313 SkFontStyle style = SkFontStyle::FromOldStyle(styleBits); |
313 SkFontStyle style = SkFontStyle(oldStyle & SkTypeface::kBold | 314 #else |
314 ? SkFontStyle::kBold_Weight | 315 SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle styl
e) const override { |
315 : SkFontStyle::kNormal_Weight, | 316 #endif |
316 SkFontStyle::kNormal_Width, | |
317 oldStyle & SkTypeface::kItalic | |
318 ? SkFontStyle::kItalic_Slant | |
319 : SkFontStyle::kUpright_Slant); | |
320 SkTypeface* tf = nullptr; | 317 SkTypeface* tf = nullptr; |
321 | 318 |
322 if (familyName) { | 319 if (familyName) { |
323 tf = this->onMatchFamilyStyle(familyName, style); | 320 tf = this->onMatchFamilyStyle(familyName, style); |
324 } | 321 } |
325 | 322 |
326 if (nullptr == tf) { | 323 if (nullptr == tf) { |
327 tf = fDefaultFamily->matchStyle(style); | 324 tf = fDefaultFamily->matchStyle(style); |
328 } | 325 } |
329 | 326 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 SkFontStyleSet_Custom* family = new SkFontStyleSet_Custom(SkString()); | 516 SkFontStyleSet_Custom* family = new SkFontStyleSet_Custom(SkString()); |
520 families->push_back().reset(family); | 517 families->push_back().reset(family); |
521 family->appendTypeface(new SkTypeface_Empty); | 518 family->appendTypeface(new SkTypeface_Empty); |
522 } | 519 } |
523 | 520 |
524 }; | 521 }; |
525 | 522 |
526 SK_API SkFontMgr* SkFontMgr_New_Custom_Empty() { | 523 SK_API SkFontMgr* SkFontMgr_New_Custom_Empty() { |
527 return new SkFontMgr_Custom(EmptyFontLoader()); | 524 return new SkFontMgr_Custom(EmptyFontLoader()); |
528 } | 525 } |
OLD | NEW |