diff options
author | Ben Wagner <bungeman@google.com> | 2017-10-06 16:05:39 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-10-09 03:13:33 +0000 |
commit | 67ef5d76406d702e7afe4ec5b490a75d9bcaba10 (patch) | |
tree | b451bec6c3d5eb4d475f640890313348426bef06 /src/core | |
parent | 92d3bc9c9f11c3a013f0006ac5694944fecc8191 (diff) |
Remove SkTypeface::Style use in API.
All known callers of SkTypeface::MakeDefault call it with kNormal and
the only users specifying kNormal explicitly are in Skia, so remove the
parameter. There appear to be no users of SkTypeface::MakeFromTypeface,
so remove it. The current alternative is SkFontMgr::matchFaceStyle which
can do a better job anyway.
Change-Id: I89d94c77f9593407b0a319786848a8b823fcbae4
Reviewed-on: https://skia-review.googlesource.com/56762
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
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); |