aboutsummaryrefslogtreecommitdiffhomepage
path: root/dm
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2018-07-03 19:34:20 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-03 19:34:28 +0000
commit58a1605d2b9bab077f53b6a223f9e7ce1891d3ea (patch)
tree8b0fe16792d55179a106164b58ff40a810afb022 /dm
parent3eff1e9647e283dd7a72ebfe7f818e11c54c20e5 (diff)
Revert "Remove gCreateTypefaceDelegate."
This reverts commit 3241149b8cc607aaeaf7897cd1e7f712354dda7e. Reason for revert: TSAN failures, e.g. https://chromium-swarm.appspot.com/task?id=3e7a42da25efd510&refresh=10 Original change's description: > Remove gCreateTypefaceDelegate. > > The PortableFontMgr is used instead. > > Change-Id: I03ecdcbef380dde2b206293e17a325cad69d7514 > Reviewed-on: https://skia-review.googlesource.com/139165 > Reviewed-by: Mike Klein <mtklein@google.com> > Commit-Queue: Ben Wagner <bungeman@google.com> TBR=mtklein@google.com,bungeman@google.com Change-Id: I9799f0637c1d39ee397c30645aa569b93dfee593 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/139280 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'dm')
-rw-r--r--dm/DM.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/dm/DM.cpp b/dm/DM.cpp
index 4656381c13..28369e9c08 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -1291,6 +1291,20 @@ static void run_test(skiatest::Test test, const GrContextOptions& grCtxOptions)
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+#define PORTABLE_FONT_PREFIX "Toy Liberation "
+
+static sk_sp<SkTypeface> create_from_name(const char familyName[], SkFontStyle style) {
+ if (familyName && strlen(familyName) > sizeof(PORTABLE_FONT_PREFIX)
+ && !strncmp(familyName, PORTABLE_FONT_PREFIX, sizeof(PORTABLE_FONT_PREFIX) - 1)) {
+ return sk_tool_utils::create_portable_typeface(familyName, style);
+ }
+ return nullptr;
+}
+
+#undef PORTABLE_FONT_PREFIX
+
+extern sk_sp<SkTypeface> (*gCreateTypefaceDelegate)(const char [], SkFontStyle );
+
int main(int argc, char** argv) {
#if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) && defined(SK_HAS_HEIF_LIBRARY)
android::ProcessState::self()->startThreadPool();
@@ -1343,6 +1357,7 @@ int main(int argc, char** argv) {
JsonWriter::DumpJson(); // It's handy for the bots to assume this is ~never missing.
SkAutoGraphics ag;
SkTaskGroup::Enabler enabled(FLAGS_threads);
+ gCreateTypefaceDelegate = &create_from_name;
if (nullptr == GetResourceAsData("images/color_wheel.png")) {
info("Some resources are missing. Do you need to set --resourcePath?\n");