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

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

Issue 1873923002: Begin switch to SkFontStyle for legacy calls. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Dont update bzl file now. 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
« no previous file with comments | « src/ports/SkFontHost_win.cpp ('k') | src/ports/SkFontMgr_custom.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
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" 8 #include "SkTypes.h"
9 9
10 #include "SkData.h" 10 #include "SkData.h"
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 SkStreamAsset* stream(data->getStream()); 480 SkStreamAsset* stream(data->getStream());
481 bool isFixedPitch; 481 bool isFixedPitch;
482 SkFontStyle style; 482 SkFontStyle style;
483 SkString name; 483 SkString name;
484 if (!fScanner.scanFont(stream, data->getIndex(), &name, &style, &isFixed Pitch, nullptr)) { 484 if (!fScanner.scanFont(stream, data->getIndex(), &name, &style, &isFixed Pitch, nullptr)) {
485 return nullptr; 485 return nullptr;
486 } 486 }
487 return new SkTypeface_AndroidStream(data, style, isFixedPitch, name); 487 return new SkTypeface_AndroidStream(data, style, isFixedPitch, name);
488 } 488 }
489 489
490 490 #ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
491 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], 491 SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBi ts) const override {
492 unsigned styleBits) const overrid e { 492 SkFontStyle style = SkFontStyle::FromOldStyle(styleBits);
493 SkFontStyle style = SkFontStyle(styleBits); 493 #else
494 494 SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle styl e) const override {
495 #endif
495 if (familyName) { 496 if (familyName) {
496 // On Android, we must return nullptr when we can't find the request ed 497 // On Android, we must return nullptr when we can't find the request ed
497 // named typeface so that the system/app can provide their own recov ery 498 // named typeface so that the system/app can provide their own recov ery
498 // mechanism. On other platforms we'd provide a typeface from the 499 // mechanism. On other platforms we'd provide a typeface from the
499 // default family instead. 500 // default family instead.
500 return this->onMatchFamilyStyle(familyName, style); 501 return this->onMatchFamilyStyle(familyName, style);
501 } 502 }
502 return fDefaultFamily->matchStyle(style); 503 return fDefaultFamily->matchStyle(style);
503 } 504 }
504 505
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 SkASSERT(custom->fSystemFontUse < SK_ARRAY_COUNT(gSystemFontUseStrings)) ; 583 SkASSERT(custom->fSystemFontUse < SK_ARRAY_COUNT(gSystemFontUseStrings)) ;
583 SkDEBUGF(("SystemFontUse: %s BasePath: %s Fonts: %s FallbackFonts: %s\n" , 584 SkDEBUGF(("SystemFontUse: %s BasePath: %s Fonts: %s FallbackFonts: %s\n" ,
584 gSystemFontUseStrings[custom->fSystemFontUse], 585 gSystemFontUseStrings[custom->fSystemFontUse],
585 custom->fBasePath, 586 custom->fBasePath,
586 custom->fFontsXml, 587 custom->fFontsXml,
587 custom->fFallbackFontsXml)); 588 custom->fFallbackFontsXml));
588 } 589 }
589 590
590 return new SkFontMgr_Android(custom); 591 return new SkFontMgr_Android(custom);
591 } 592 }
OLDNEW
« no previous file with comments | « src/ports/SkFontHost_win.cpp ('k') | src/ports/SkFontMgr_custom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698