Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(449)

Unified Diff: include/core/SkTypeface.h

Issue 1818043002: SkTypeface::MakeFromName to take SkFontStyle. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: CL rebased. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkTypeface.cpp » ('j') | src/core/SkTypeface.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkTypeface.h
diff --git a/include/core/SkTypeface.h b/include/core/SkTypeface.h
index 3a47bd2bb3f3997adb6cdc2df342b13e17d74464..9e1d2f3a7f93ce1182bffe36a677fc6a09a298dc 100644
--- a/include/core/SkTypeface.h
+++ b/include/core/SkTypeface.h
@@ -29,6 +29,12 @@ typedef uint32_t SkFontID;
/** Machine endian. */
typedef uint32_t SkFontTableTag;
+#ifdef SK_INTERNAL
+#ifndef SK_DONT_USE_LEGACY_TYPEFACE_MAKE_FROM_NAME
+#define SK_DONT_USE_LEGACY_TYPEFACE_MAKE_FROM_NAME
+#endif
+#endif
+
/** \class SkTypeface
The SkTypeface class specifies the typeface and intrinsic style of a font.
@@ -100,6 +106,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);
+
+#ifndef SK_DONT_USE_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 +128,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
« no previous file with comments | « no previous file | src/core/SkTypeface.cpp » ('j') | src/core/SkTypeface.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698