| OLD | NEW |
| 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 Loading... |
| 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 #ifdef SK_VERY_LEGACY_CREATE_TYPEFACE | |
| 491 SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBi
ts) const override { | |
| 492 SkFontStyle style = SkFontStyle::FromOldStyle(styleBits); | |
| 493 #else | |
| 494 SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle styl
e) const override { | 490 SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle styl
e) const override { |
| 495 #endif | |
| 496 if (familyName) { | 491 if (familyName) { |
| 497 // On Android, we must return nullptr when we can't find the request
ed | 492 // On Android, we must return nullptr when we can't find the request
ed |
| 498 // named typeface so that the system/app can provide their own recov
ery | 493 // named typeface so that the system/app can provide their own recov
ery |
| 499 // mechanism. On other platforms we'd provide a typeface from the | 494 // mechanism. On other platforms we'd provide a typeface from the |
| 500 // default family instead. | 495 // default family instead. |
| 501 return this->onMatchFamilyStyle(familyName, style); | 496 return this->onMatchFamilyStyle(familyName, style); |
| 502 } | 497 } |
| 503 return fDefaultFamily->matchStyle(style); | 498 return fDefaultFamily->matchStyle(style); |
| 504 } | 499 } |
| 505 | 500 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 SkASSERT(custom->fSystemFontUse < SK_ARRAY_COUNT(gSystemFontUseStrings))
; | 578 SkASSERT(custom->fSystemFontUse < SK_ARRAY_COUNT(gSystemFontUseStrings))
; |
| 584 SkDEBUGF(("SystemFontUse: %s BasePath: %s Fonts: %s FallbackFonts: %s\n"
, | 579 SkDEBUGF(("SystemFontUse: %s BasePath: %s Fonts: %s FallbackFonts: %s\n"
, |
| 585 gSystemFontUseStrings[custom->fSystemFontUse], | 580 gSystemFontUseStrings[custom->fSystemFontUse], |
| 586 custom->fBasePath, | 581 custom->fBasePath, |
| 587 custom->fFontsXml, | 582 custom->fFontsXml, |
| 588 custom->fFallbackFontsXml)); | 583 custom->fFallbackFontsXml)); |
| 589 } | 584 } |
| 590 | 585 |
| 591 return new SkFontMgr_Android(custom); | 586 return new SkFontMgr_Android(custom); |
| 592 } | 587 } |
| OLD | NEW |