Reland "Reland "Migrate many direct and indirect uses of SkFontMgr to use TestFontMgr""

This is a reland of commit bea8af81c35eb402ceaf2a12b4aaaebcd97015a1

This adds in the custom directory SkFontMgr to FontToolUtils.cpp,
which is important for our ChromeOS tests. Also, our sanitizers
don't always build with fontconfig support, so there need to be some
fallbacks to appease the compilation step, even though we don't
run all the binaries with the sanitizers (e.g. create_test_font)

Original change's description:
> Reland "Migrate many direct and indirect uses of SkFontMgr to use TestFontMgr"
>
> This is a reland of commit 3258c98d2edf072073d0e98d79d59e3458b77089
>
> It introduces SK_FONTMGR_*_AVAILABLE defines, such that FonToolUtils.cpp
> (and our clients) can detect at compile time what GN or Bazel depends
> on (by exporting those defines when depended upon). This avoids us
> having to make opinionated decisions based on the target platform
> (which was causing issues with ChromeOS and Android Framework).
>
> Original change's description:
> > Migrate many direct and indirect uses of SkFontMgr to use TestFontMgr
> >
> > This removes most direct (e.g. SkFontMgr::RefDefault) or indirect
> > (e.g. SkTypeface::MakeFromData) uses of the default SkFontMgr in Skia.
> >
> > There are a few other cases that impact public APIs or could impact
> > current clients, which will be handled separately (e.g. Skottie)
> >
> > Suggested Reading Order:
> >  - tools/fonts/FontToolUtils.cpp to see that this absorbed
> >    tools/flags/CommonFlagsFontMgr.cpp and the two flags which
> >    controlled FontMgrs. Notice this no longer needs an initialization
> >    call, because the first call to ToolUtils::TestFontMgr() will
> >    lazily read and apply these flags.
> >  - tools/fiddle/* to see a new fontMgr global variable is made
> >    available, which is *always* the FontConfig one, due to the
> >    fact that fiddle only runs on Linux (and there are no plans
> >    to change that).
> >  - Remaining deleted files - these had bitrotting code related to
> >    fonts that was identified via grep and deemed not worth fixing
> >    since it is not being compiled anyway.
> >  - fuzz/ to see many of these now have a convenient function to
> >    call to explicitly set up the portable fontmgr. With this
> >    and the addition of ToolUtils::FontMgrIsGDI(), src/core/SkFontMgrPriv.h
> >    is no longer used (outside of the #define guarded, deprecated
> >    FontMgr Factory functions).
> >  - Other files in any order - these remaining changes were pretty
> >    mechanical.
> >
> > See also:
> >  - http://review.skia.org/772660
> >  - http://review.skia.org/772903
> >
> > Bug: b/305780908
> > Change-Id: I46a43750ebfd9f9dbe743931cb99a5fe70a0dc0c
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/772659
> > Commit-Queue: Kevin Lubick <[email protected]>
> > Reviewed-by: Ben Wagner <[email protected]>
>
> Bug: b/305780908
> Change-Id: I361ddaa56250f76a66104ddf8a8b29942d13838b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/775996
> Reviewed-by: Ben Wagner <[email protected]>

Bug: b/305780908
Change-Id: I88bce4d9434874f3cc9674f9f019e39c04594927
Cq-Include-Trybots: luci.skia.skia.primary:Build-Debian10-Clang-x86_64-Release-MSAN
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/777536
Reviewed-by: Ben Wagner <[email protected]>
Commit-Queue: Kevin Lubick <[email protected]>
diff --git a/tests/FontHostStreamTest.cpp b/tests/FontHostStreamTest.cpp
index 26d71aa..a36450f 100644
--- a/tests/FontHostStreamTest.cpp
+++ b/tests/FontHostStreamTest.cpp
@@ -9,6 +9,7 @@
 #include "include/core/SkCanvas.h"
 #include "include/core/SkColor.h"
 #include "include/core/SkFont.h"
+#include "include/core/SkFontMgr.h"
 #include "include/core/SkFontStyle.h"
 #include "include/core/SkGraphics.h"
 #include "include/core/SkPaint.h"
@@ -21,6 +22,7 @@
 #include "src/core/SkFontDescriptor.h"
 #include "src/core/SkFontPriv.h"
 #include "tests/Test.h"
+#include "tools/fonts/FontToolUtils.h"
 
 #include <memory>
 #include <utility>
@@ -72,7 +74,7 @@
         SkPaint paint;
         paint.setColor(SK_ColorGRAY);
 
-        SkFont font(SkTypeface::MakeFromName("Georgia", SkFontStyle()), 30);
+        SkFont font(ToolUtils::CreateTestTypeface("Georgia", SkFontStyle()), 30);
         font.setEdging(SkFont::Edging::kAlias);
 
         const SkIRect origRect = SkIRect::MakeWH(64, 64);
@@ -86,13 +88,15 @@
         drawBG(&origCanvas);
         origCanvas.drawString("A", point.fX, point.fY, font, paint);
 
-        sk_sp<SkTypeface> typeface = SkFontPriv::RefTypefaceOrDefault(font);
+        sk_sp<SkFontMgr> mgr = ToolUtils::TestFontMgr();
+        sk_sp<SkTypeface> typeface = font.refTypeface();
+        SkASSERT_RELEASE(typeface);
 
         {
             SkDynamicMemoryWStream wstream;
             typeface->serialize(&wstream, SkTypeface::SerializeBehavior::kDoIncludeData);
             std::unique_ptr<SkStreamAsset> stream = wstream.detachAsStream();
-            sk_sp<SkTypeface> deserializedTypeface = SkTypeface::MakeDeserialize(&*stream);
+            sk_sp<SkTypeface> deserializedTypeface = SkTypeface::MakeDeserialize(&*stream, mgr);
             if (!deserializedTypeface) {
                 REPORTER_ASSERT(reporter, deserializedTypeface);
                 return;
@@ -122,7 +126,7 @@
                 return;
             }
 
-            sk_sp<SkTypeface> streamTypeface(SkTypeface::MakeFromStream(std::move(fontData)));
+            sk_sp<SkTypeface> streamTypeface(mgr->makeFromStream(std::move(fontData), 0));
             if (!streamTypeface) {
                 // TODO: enable assert after SkTypeface::MakeFromStream uses factories
                 //REPORTER_ASSERT(reporter, streamTypeface);