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 "SkTypes.h" // Keep this before any #ifdef ... | 8 #include "SkTypes.h" // Keep this before any #ifdef ... |
9 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) | 9 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) |
10 | 10 |
(...skipping 2541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2552 } | 2552 } |
2553 | 2553 |
2554 SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override
{ | 2554 SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override
{ |
2555 AutoCFRelease<CGDataProviderRef> pr(CGDataProviderCreateWithFilename(pat
h)); | 2555 AutoCFRelease<CGDataProviderRef> pr(CGDataProviderCreateWithFilename(pat
h)); |
2556 if (nullptr == pr) { | 2556 if (nullptr == pr) { |
2557 return nullptr; | 2557 return nullptr; |
2558 } | 2558 } |
2559 return create_from_dataProvider(pr); | 2559 return create_from_dataProvider(pr); |
2560 } | 2560 } |
2561 | 2561 |
2562 #ifdef SK_VERY_LEGACY_CREATE_TYPEFACE | |
2563 SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBi
ts) const override { | |
2564 SkFontStyle style = SkFontStyle::FromOldStyle(styleBits); | |
2565 #else | |
2566 SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle styl
e) const override { | 2562 SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle styl
e) const override { |
2567 #endif | |
2568 if (familyName) { | 2563 if (familyName) { |
2569 familyName = map_css_names(familyName); | 2564 familyName = map_css_names(familyName); |
2570 } | 2565 } |
2571 | 2566 |
2572 if (!familyName || !*familyName) { | 2567 if (!familyName || !*familyName) { |
2573 familyName = FONT_DEFAULT_NAME; | 2568 familyName = FONT_DEFAULT_NAME; |
2574 } | 2569 } |
2575 | 2570 |
2576 SkTypeface* face = NewFromName(familyName, style); | 2571 SkTypeface* face = NewFromName(familyName, style); |
2577 if (face) { | 2572 if (face) { |
2578 return face; | 2573 return face; |
2579 } | 2574 } |
2580 | 2575 |
2581 return SkSafeRef(GetDefaultFace()); | 2576 return SkSafeRef(GetDefaultFace()); |
2582 } | 2577 } |
2583 }; | 2578 }; |
2584 | 2579 |
2585 /////////////////////////////////////////////////////////////////////////////// | 2580 /////////////////////////////////////////////////////////////////////////////// |
2586 | 2581 |
2587 SkFontMgr* SkFontMgr::Factory() { return new SkFontMgr_Mac; } | 2582 SkFontMgr* SkFontMgr::Factory() { return new SkFontMgr_Mac; } |
2588 | 2583 |
2589 #endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) | 2584 #endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) |
OLD | NEW |