aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkTypeface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/SkTypeface.cpp')
-rw-r--r--src/core/SkTypeface.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp
index 8e90f51a9b..6b1e3618c6 100644
--- a/src/core/SkTypeface.cpp
+++ b/src/core/SkTypeface.cpp
@@ -29,6 +29,8 @@ extern void WhitelistSerializeTypeface(const SkTypeface*, SkWStream* );
#define SK_TYPEFACE_DELEGATE nullptr
#endif
+sk_sp<SkTypeface> (*gCreateTypefaceDelegate)(const char[], SkFontStyle) = nullptr;
+
void (*gSerializeTypefaceDelegate)(const SkTypeface*, SkWStream* ) = SK_TYPEFACE_DELEGATE;
sk_sp<SkTypeface> (*gDeserializeTypefaceDelegate)(SkStream* ) = nullptr;
@@ -127,6 +129,12 @@ bool SkTypeface::Equal(const SkTypeface* facea, const SkTypeface* faceb) {
sk_sp<SkTypeface> SkTypeface::MakeFromName(const char name[],
SkFontStyle fontStyle) {
+ if (gCreateTypefaceDelegate) {
+ sk_sp<SkTypeface> result = (*gCreateTypefaceDelegate)(name, fontStyle);
+ if (result) {
+ return result;
+ }
+ }
if (nullptr == name && (fontStyle.slant() == SkFontStyle::kItalic_Slant ||
fontStyle.slant() == SkFontStyle::kUpright_Slant) &&
(fontStyle.weight() == SkFontStyle::kBold_Weight ||