Today's gm include many differences caused by platform font implementations.
This experiment replaces the label used in the aaxfermodes gm with
aliased text generated from paths common to all platforms.

Since there is no way today to generate all dm output from trybots,
this will be checked in to confirm that this strategy provides simpler
output across devices.

This does not introduce a new public interface; instead, dm uses
a extern backdoor to install the SkTypeface::CreateFromName
handler.

Review URL: https://codereview.chromium.org/1163283002
diff --git a/dm/DM.cpp b/dm/DM.cpp
index 55563fe..0174b73 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -14,6 +14,7 @@
 #include "SkBBHFactory.h"
 #include "SkChecksum.h"
 #include "SkCommonFlags.h"
+#include "SkFontMgr.h"
 #include "SkForceLinking.h"
 #include "SkGraphics.h"
 #include "SkInstCnt.h"
@@ -24,6 +25,7 @@
 #include "SkThreadUtils.h"
 #include "Test.h"
 #include "Timer.h"
+#include "sk_tool_utils.h"
 
 DEFINE_string(src, "tests gm skp image", "Source types to test.");
 DEFINE_bool(nameByHash, false,
@@ -707,6 +709,20 @@
     intentionallyLeaked->start();
 }
 
+#define PORTABLE_FONT_PREFIX "Toy Liberation "
+
+static SkTypeface* create_from_name(const char familyName[], SkTypeface::Style 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_always(familyName, style);
+    }
+    return NULL;
+}
+
+#undef PORTABLE_FONT_PREFIX
+
+extern SkTypeface* (*gCreateTypefaceDelegate)(const char [], SkTypeface::Style );
+
 int dm_main();
 int dm_main() {
     SetupCrashHandler();
@@ -715,6 +731,7 @@
     if (FLAGS_leaks) {
         SkInstCountPrintLeaksOnExit();
     }
+    gCreateTypefaceDelegate = &create_from_name;
 
     start_keepalive();