Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(617)

Side by Side Diff: src/ports/SkFontHost_mac.cpp

Issue 1873923002: Begin switch to SkFontStyle for legacy calls. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fixes, rebase. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2554 matching lines...) Expand 10 before | Expand all | Expand 10 after
2565 } 2565 }
2566 2566
2567 SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override { 2567 SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override {
2568 AutoCFRelease<CGDataProviderRef> pr(CGDataProviderCreateWithFilename(pat h)); 2568 AutoCFRelease<CGDataProviderRef> pr(CGDataProviderCreateWithFilename(pat h));
2569 if (nullptr == pr) { 2569 if (nullptr == pr) {
2570 return nullptr; 2570 return nullptr;
2571 } 2571 }
2572 return create_from_dataProvider(pr); 2572 return create_from_dataProvider(pr);
2573 } 2573 }
2574 2574
2575 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], 2575 #ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
2576 unsigned styleBits) const overrid e { 2576 SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBi ts) const override {
2577 2577 SkFontStyle style = SkFontStyle::FromOldStyle(styleBits);
2578 SkFontStyle style = SkFontStyle((SkTypeface::Style)styleBits); 2578 #else
2579 SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle styl e) const override {
2580 #endif
2579 if (familyName) { 2581 if (familyName) {
2580 familyName = map_css_names(familyName); 2582 familyName = map_css_names(familyName);
2581 } 2583 }
2582 2584
2583 if (!familyName || !*familyName) { 2585 if (!familyName || !*familyName) {
2584 familyName = FONT_DEFAULT_NAME; 2586 familyName = FONT_DEFAULT_NAME;
2585 } 2587 }
2586 2588
2587 SkTypeface* face = NewFromName(familyName, style); 2589 SkTypeface* face = NewFromName(familyName, style);
2588 if (face) { 2590 if (face) {
2589 return face; 2591 return face;
2590 } 2592 }
2591 2593
2592 return SkSafeRef(GetDefaultFace()); 2594 return SkSafeRef(GetDefaultFace());
2593 } 2595 }
2594 }; 2596 };
2595 2597
2596 /////////////////////////////////////////////////////////////////////////////// 2598 ///////////////////////////////////////////////////////////////////////////////
2597 2599
2598 SkFontMgr* SkFontMgr::Factory() { return new SkFontMgr_Mac; } 2600 SkFontMgr* SkFontMgr::Factory() { return new SkFontMgr_Mac; }
2599 2601
2600 #endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) 2602 #endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698