[base] Replace SkFontMgr::RefDefault() with FreeTypeFontMgr
Android Renderengine doesn't draw any text, but hwui needs
to turn bytes into SkTypefaces and it currently uses Skia's
"Empty Custom" SkFontMgr, which is really just a wrapper around
FreeType. This makes that connection explicit instead of relying
on SkFontMgr::RefDefault(), which is going away soon.
Change-Id: Ida96538c76e069ec86e8dc078ef329cfaeac5d78
Bug: b/305780908
diff --git a/libs/hwui/jni/FontFamily.cpp b/libs/hwui/jni/FontFamily.cpp
index 0c3af61..e6d790f 100644
--- a/libs/hwui/jni/FontFamily.cpp
+++ b/libs/hwui/jni/FontFamily.cpp
@@ -31,6 +31,7 @@
#include <minikin/FontFamily.h>
#include <minikin/LocaleList.h>
#include <ui/FatVector.h>
+#include <utils/TypefaceUtils.h>
#include <memory>
@@ -125,7 +126,7 @@
args.setCollectionIndex(ttcIndex);
args.setVariationDesignPosition({skVariation.data(), static_cast<int>(skVariation.size())});
- sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault());
+ sk_sp<SkFontMgr> fm = android::FreeTypeFontMgr();
sk_sp<SkTypeface> face(fm->makeFromStream(std::move(fontData), args));
if (face == NULL) {
ALOGE("addFont failed to create font, invalid request");