diff options
author | mboc <mboc@opera.com> | 2016-05-31 11:42:36 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-31 11:42:37 -0700 |
commit | ee6a9919a362e16c1d84a870ce867d1ad7b8a141 (patch) | |
tree | 971189523fe82821c82a936cafaefd59b76338f7 /include/core/SkTypeface.h | |
parent | bfa9275968d11d459b30a485cedcb55c7fecf9d7 (diff) |
SkTypeface::MakeFromName to take SkFontStyle.
SkTypeface::MakeFromName currently takes SkTypeface::Style,
which is quite limited. This starts the transition to this
function taking SkFontStyle instead.
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1818043002
TBR=reed
He said it sounded like a good idea.
Review-Url: https://codereview.chromium.org/1818043002
Diffstat (limited to 'include/core/SkTypeface.h')
-rw-r--r-- | include/core/SkTypeface.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/include/core/SkTypeface.h b/include/core/SkTypeface.h index 3a47bd2bb3..f67ba37416 100644 --- a/include/core/SkTypeface.h +++ b/include/core/SkTypeface.h @@ -100,6 +100,19 @@ public: } #endif + /** Creates a new reference to the typeface that most closely matches the + requested familyName and fontStyle. This method allows extended font + face specifiers as in the SkFontStyle type. Will never return null. + + @param familyName May be NULL. The name of the font family. + @param fontStyle The style of the typeface. + @return reference to the closest-matching typeface. Call must call + unref() when they are done. + */ + static sk_sp<SkTypeface> MakeFromName(const char familyName[], + SkFontStyle fontStyle); + +#ifdef SK_SUPPORT_LEGACY_TYPEFACE_MAKE_FROM_NAME /** Return the typeface that most closely matches the requested familyName and style. Pass nullptr as the familyName to request the default font for the requested style. Will never return nullptr. @@ -109,9 +122,10 @@ public: @return the closest-matching typeface. */ static sk_sp<SkTypeface> MakeFromName(const char familyName[], Style style); +#endif #ifdef SK_SUPPORT_LEGACY_TYPEFACE_PTR static SkTypeface* CreateFromName(const char familyName[], Style style) { - return MakeFromName(familyName, style).release(); + return MakeFromName(familyName, SkFontStyle::FromOldStyle(style)).release(); } #endif |