| 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 | 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 Loading... |
| 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 } |
| OLD | NEW |