diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkTypeface.cpp | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp index 83edea9775..0c8c4b96ae 100644 --- a/src/core/SkTypeface.cpp +++ b/src/core/SkTypeface.cpp @@ -99,8 +99,8 @@ SkTypeface* SkTypeface::GetDefaultTypeface(Style style) { return defaults[style].get(); } -sk_sp<SkTypeface> SkTypeface::MakeDefault(Style style) { - return sk_ref_sp(GetDefaultTypeface(style)); +sk_sp<SkTypeface> SkTypeface::MakeDefault() { + return sk_ref_sp(GetDefaultTypeface(SkTypeface::kNormal)); } uint32_t SkTypeface::UniqueID(const SkTypeface* face) { @@ -128,29 +128,16 @@ sk_sp<SkTypeface> SkTypeface::MakeFromName(const char name[], fontStyle.slant() == SkFontStyle::kUpright_Slant) && (fontStyle.weight() == SkFontStyle::kBold_Weight || fontStyle.weight() == SkFontStyle::kNormal_Weight)) { - return MakeDefault(static_cast<SkTypeface::Style>( + return sk_ref_sp(GetDefaultTypeface(static_cast<SkTypeface::Style>( (fontStyle.slant() == SkFontStyle::kItalic_Slant ? SkTypeface::kItalic : SkTypeface::kNormal) | (fontStyle.weight() == SkFontStyle::kBold_Weight ? SkTypeface::kBold : - SkTypeface::kNormal))); + SkTypeface::kNormal)))); } sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault()); return fm->legacyMakeTypeface(name, fontStyle); } -sk_sp<SkTypeface> SkTypeface::MakeFromTypeface(SkTypeface* family, Style s) { - if (!family) { - return SkTypeface::MakeDefault(s); - } - - if (family->fontStyle() == SkFontStyle::FromOldStyle(s)) { - return sk_ref_sp(family); - } - - sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault()); - return sk_sp<SkTypeface>(fm->matchFaceStyle(family, SkFontStyle::FromOldStyle(s))); -} - sk_sp<SkTypeface> SkTypeface::MakeFromStream(SkStreamAsset* stream, int index) { sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault()); return fm->makeFromStream(std::unique_ptr<SkStreamAsset>(stream), index); |