remove platform_font_name()

It's used rarely and now that we're mostly using portable fonts,
it only serves to confuse.  Sans-serif doesn't seem to work anyway.

Simplify gm/typeface.cpp to just test the default typeface.

Change-Id: I091239ea91af9d9e01d3c76280636a6061b5fb5c
Reviewed-on: https://skia-review.googlesource.com/71261
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
diff --git a/gm/gammatext.cpp b/gm/gammatext.cpp
index 0b56001..e248f58 100644
--- a/gm/gammatext.cpp
+++ b/gm/gammatext.cpp
@@ -19,11 +19,6 @@
                                         SkShader::kClamp_TileMode);
 }
 
-static bool setFont(SkPaint* paint, const char name[]) {
-    paint->setTypeface(SkTypeface::MakeFromName(name, SkFontStyle()));
-    return SkToBool(paint->getTypeface());
-}
-
 /**
    Test a set of clipping problems discovered while writing blitAntiRect,
    and test all the code paths through the clipping blitters.
@@ -69,7 +64,6 @@
         size_t len = strlen(text);
 
         SkPaint paint;
-        setFont(&paint, sk_tool_utils::platform_font_name("serif"));
         paint.setTextSize(SkIntToScalar(16));
         paint.setAntiAlias(true);
         paint.setLCDRenderText(true);
diff --git a/gm/typeface.cpp b/gm/typeface.cpp
index 8ac41c5..aa90a84 100644
--- a/gm/typeface.cpp
+++ b/gm/typeface.cpp
@@ -73,28 +73,17 @@
     canvas->drawPosText(glyphs, glyphCount * sizeof(uint16_t), pos, glyphPaint);
 }
 
-constexpr struct {
-    const char* fName;
-    SkFontStyle fStyle;
-} gFaceStyles[] = {
-    { "sans-serif", SkFontStyle::Normal() },
-    { "sans-serif", SkFontStyle::Bold() },
-    { "sans-serif", SkFontStyle::Italic() },
-    { "sans-serif", SkFontStyle::BoldItalic() },
-    { "serif", SkFontStyle::Normal() },
-    { "serif", SkFontStyle::Bold() },
-    { "serif", SkFontStyle::Italic() },
-    { "serif", SkFontStyle::BoldItalic() },
-    { "monospace", SkFontStyle::Normal() },
-    { "monospace", SkFontStyle::Bold() },
-    { "monospace", SkFontStyle::Italic() },
-    { "monospace", SkFontStyle::BoldItalic() },
+static constexpr SkFontStyle gStyles[] = {
+    SkFontStyle::Normal(),
+    SkFontStyle::Bold(),
+    SkFontStyle::Italic(),
+    SkFontStyle::BoldItalic(),
 };
 
-constexpr int gFaceStylesCount = SK_ARRAY_COUNT(gFaceStyles);
+constexpr int gStylesCount = SK_ARRAY_COUNT(gStyles);
 
 class TypefaceStylesGM : public skiagm::GM {
-    sk_sp<SkTypeface> fFaces[gFaceStylesCount];
+    sk_sp<SkTypeface> fFaces[gStylesCount];
     bool fApplyKerning;
 
 public:
@@ -105,9 +94,8 @@
 
 protected:
     void onOnceBeforeDraw() override {
-        for (int i = 0; i < gFaceStylesCount; i++) {
-            fFaces[i] = SkTypeface::MakeFromName(
-                    sk_tool_utils::platform_font_name(gFaceStyles[i].fName), gFaceStyles[i].fStyle);
+        for (int i = 0; i < gStylesCount; i++) {
+            fFaces[i] = SkTypeface::MakeFromName(nullptr, gStyles[i]);
         }
     }
 
@@ -141,7 +129,7 @@
         } else {
             paint.setLinearText(true);
         }
-        for (int i = 0; i < gFaceStylesCount; i++) {
+        for (int i = 0; i < gStylesCount; i++) {
             paint.setTypeface(fFaces[i]);
             canvas->drawText(text, textLen, x, y, paint);
             if (fApplyKerning) {
diff --git a/gm/verttext2.cpp b/gm/verttext2.cpp
index d7ef3f7..d917ead 100644
--- a/gm/verttext2.cpp
+++ b/gm/verttext2.cpp
@@ -24,10 +24,8 @@
     void onOnceBeforeDraw() override {
         const int pointSize = 24;
         textHeight = SkIntToScalar(pointSize);
-        fProp = SkTypeface::MakeFromName(sk_tool_utils::platform_font_name("sans-serif"),
-                SkFontStyle());
-        fMono = SkTypeface::MakeFromName(sk_tool_utils::platform_font_name("monospace"),
-                SkFontStyle());
+        fProp = SkTypeface::MakeFromName("sans-serif", SkFontStyle());
+        fMono = SkTypeface::MakeFromName("monospace",  SkFontStyle());
     }
 
     SkString onShortName() override {
diff --git a/tools/sk_tool_utils.cpp b/tools/sk_tool_utils.cpp
index d2063df..b23676f 100644
--- a/tools/sk_tool_utils.cpp
+++ b/tools/sk_tool_utils.cpp
@@ -22,16 +22,6 @@
 
 namespace sk_tool_utils {
 
-/* these are the default fonts chosen by Chrome for serif, sans-serif, and monospace */
-static const char* gStandardFontNames[][3] = {
-    { "Times", "Helvetica", "Courier" }, // Mac
-    { "Times New Roman", "Helvetica", "Courier" }, // iOS
-    { "Times New Roman", "Arial", "Courier New" }, // Win
-    { "Times New Roman", "Arial", "Monospace" }, // Ubuntu
-    { "serif", "sans-serif", "monospace" }, // Android
-    { "Tinos", "Arimo", "Cousine" } // ChromeOS
-};
-
 static bool starts_with(const char* str, const char* prefix) {
     return 0 == strncmp(str, prefix, strlen(prefix));
 }
@@ -45,41 +35,6 @@
     return "";
 }
 
-const char* platform_font_name(const char* name) {
-    int index;
-    if (!strcmp(name, "serif")) {
-        index = 0;
-    } else if (!strcmp(name, "san-serif")) {
-        index = 1;
-    } else if (!strcmp(name, "monospace")) {
-        index = 2;
-    } else {
-        return name;
-    }
-
-    const char* platform = platform_os_name();
-
-    if (starts_with(platform, "Mac")) {
-        return gStandardFontNames[0][index];
-    }
-    if (starts_with(platform, "iOS")) {
-        return gStandardFontNames[1][index];
-    }
-    if (starts_with(platform, "Win")) {
-        return gStandardFontNames[2][index];
-    }
-    if (starts_with(platform, "Ubuntu") || starts_with(platform, "Debian")) {
-        return gStandardFontNames[3][index];
-    }
-    if (starts_with(platform, "Android")) {
-        return gStandardFontNames[4][index];
-    }
-    if (starts_with(platform, "ChromeOS")) {
-        return gStandardFontNames[5][index];
-    }
-    return name;
-}
-
 const char* platform_os_emoji() {
     const char* osName = platform_os_name();
     if (starts_with(osName, "Android") ||
diff --git a/tools/sk_tool_utils.h b/tools/sk_tool_utils.h
index fe9daad..857ad5a 100644
--- a/tools/sk_tool_utils.h
+++ b/tools/sk_tool_utils.h
@@ -57,11 +57,6 @@
     const char* platform_font_manager();
 
     /**
-     * Map serif, san-serif, and monospace to the platform-specific font name.
-     */
-    const char* platform_font_name(const char* name);
-
-    /**
      * Sets the paint to use a platform-independent text renderer
      */
     void set_portable_typeface(SkPaint* paint, const char* name = nullptr,