From 58a1605d2b9bab077f53b6a223f9e7ce1891d3ea Mon Sep 17 00:00:00 2001 From: Ethan Nicholas Date: Tue, 3 Jul 2018 19:34:20 +0000 Subject: 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 > Commit-Queue: Ben Wagner 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 Commit-Queue: Ethan Nicholas --- dm/DM.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'dm') 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 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 (*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"); -- cgit v1.2.3