diff options
author | 2017-11-06 12:02:47 -0500 | |
---|---|---|
committer | 2017-11-06 21:21:42 +0000 | |
commit | 3186821c7e4448c4b586dde590760e22b46cf166 (patch) | |
tree | 52eb0b54c4ea090417d0d02d3c0b1ed3bdeb3c8e /src/core | |
parent | fddb6c03990f3eb3dfd90a14aacddb82613591dd (diff) |
add a SkFontMgr to DM that returns portable fonts
Controlled by --[no]nativeFonts, and still defaults to native fonts.
Change-Id: Ib2879e69fadb63ddb5a17a7e4ae227941893b8cf
Reviewed-on: https://skia-review.googlesource.com/67806
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkFontMgr.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/SkFontMgr.cpp b/src/core/SkFontMgr.cpp index 33eb2301bd..4e64de1186 100644 --- a/src/core/SkFontMgr.cpp +++ b/src/core/SkFontMgr.cpp @@ -172,12 +172,16 @@ sk_sp<SkTypeface> SkFontMgr::onMakeFromFontData(std::unique_ptr<SkFontData> data return this->makeFromStream(data->detachStream(), data->getIndex()); } +// A global function pointer that's not declared, but can be overriden at startup by test tools. +sk_sp<SkFontMgr> (*gSkFontMgr_DefaultFactory)() = nullptr; + sk_sp<SkFontMgr> SkFontMgr::RefDefault() { static SkOnce once; static sk_sp<SkFontMgr> singleton; once([]{ - sk_sp<SkFontMgr> fm = SkFontMgr::Factory(); + sk_sp<SkFontMgr> fm = gSkFontMgr_DefaultFactory ? gSkFontMgr_DefaultFactory() + : SkFontMgr::Factory(); singleton = fm ? std::move(fm) : sk_make_sp<SkEmptyFontMgr>(); }); return singleton; |