Loading core/java/android/text/flags/flags.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -215,3 +215,10 @@ flag { bug: "355296926" is_exported: true } flag { name: "use_fontation_by_default" namespace: "text" description: "Use Fontation(Skrifa) as a default text reader." bug: "405267306" } libs/hwui/FeatureFlags.h +9 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,15 @@ inline bool typeface_redesign_readonly() { #endif // __ANDROID__ } inline bool use_fontation_by_default() { #ifdef __ANDROID__ static bool flag = com_android_text_flags_use_fontation_by_default(); return flag; #else return true; #endif // __ANDROID__ } } // namespace text_feature namespace view_accessibility_flags { Loading libs/hwui/Properties.h +10 −0 Original line number Diff line number Diff line Loading @@ -238,6 +238,16 @@ enum DebugLevel { #define PROPERTY_EARLY_PRELOAD_GL_CONTEXT "debug.hwui.early_preload_gl_context" /** * Property for font reading library. */ #define PROPERTY_SKTYPEFACE_BACKEND "debug.hwui.text.backend" enum class SkTypefaceBackend { kAuto = 0, kFreeType = 1, kFontation = 2, }; /////////////////////////////////////////////////////////////////////////////// // Misc /////////////////////////////////////////////////////////////////////////////// Loading libs/hwui/hwui/Typeface.cpp +1 −3 Original line number Diff line number Diff line Loading @@ -160,9 +160,7 @@ void Typeface::setRobotoTypefaceForTest() { LOG_ALWAYS_FATAL_IF(fstat(fd, &st) == -1, "Failed to stat file %s", kRobotoFont); void* data = mmap(nullptr, st.st_size, PROT_READ, MAP_SHARED, fd, 0); std::unique_ptr<SkStreamAsset> fontData(new SkMemoryStream(data, st.st_size)); sk_sp<SkFontMgr> fm = android::FreeTypeFontMgr(); LOG_ALWAYS_FATAL_IF(fm == nullptr, "Could not load FreeType SkFontMgr"); sk_sp<SkTypeface> typeface = fm->makeFromStream(std::move(fontData)); sk_sp<SkTypeface> typeface = android::makeSkTypeface(std::move(fontData), SkFontArguments()); LOG_ALWAYS_FATAL_IF(typeface == nullptr, "Failed to make typeface from %s", kRobotoFont); std::shared_ptr<minikin::MinikinFont> font = std::make_shared<MinikinFontSkia>( Loading libs/hwui/jni/FontFamily.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -126,8 +126,7 @@ static bool addSkTypeface(NativeFamilyBuilder* builder, sk_sp<SkData>&& data, in args.setCollectionIndex(ttcIndex); args.setVariationDesignPosition({skVariation.data(), static_cast<int>(skVariation.size())}); sk_sp<SkFontMgr> fm = android::FreeTypeFontMgr(); sk_sp<SkTypeface> face(fm->makeFromStream(std::move(fontData), args)); sk_sp<SkTypeface> face = makeSkTypeface(std::move(fontData), args); if (face == NULL) { ALOGE("addFont failed to create font, invalid request"); builder->axes.clear(); Loading Loading
core/java/android/text/flags/flags.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -215,3 +215,10 @@ flag { bug: "355296926" is_exported: true } flag { name: "use_fontation_by_default" namespace: "text" description: "Use Fontation(Skrifa) as a default text reader." bug: "405267306" }
libs/hwui/FeatureFlags.h +9 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,15 @@ inline bool typeface_redesign_readonly() { #endif // __ANDROID__ } inline bool use_fontation_by_default() { #ifdef __ANDROID__ static bool flag = com_android_text_flags_use_fontation_by_default(); return flag; #else return true; #endif // __ANDROID__ } } // namespace text_feature namespace view_accessibility_flags { Loading
libs/hwui/Properties.h +10 −0 Original line number Diff line number Diff line Loading @@ -238,6 +238,16 @@ enum DebugLevel { #define PROPERTY_EARLY_PRELOAD_GL_CONTEXT "debug.hwui.early_preload_gl_context" /** * Property for font reading library. */ #define PROPERTY_SKTYPEFACE_BACKEND "debug.hwui.text.backend" enum class SkTypefaceBackend { kAuto = 0, kFreeType = 1, kFontation = 2, }; /////////////////////////////////////////////////////////////////////////////// // Misc /////////////////////////////////////////////////////////////////////////////// Loading
libs/hwui/hwui/Typeface.cpp +1 −3 Original line number Diff line number Diff line Loading @@ -160,9 +160,7 @@ void Typeface::setRobotoTypefaceForTest() { LOG_ALWAYS_FATAL_IF(fstat(fd, &st) == -1, "Failed to stat file %s", kRobotoFont); void* data = mmap(nullptr, st.st_size, PROT_READ, MAP_SHARED, fd, 0); std::unique_ptr<SkStreamAsset> fontData(new SkMemoryStream(data, st.st_size)); sk_sp<SkFontMgr> fm = android::FreeTypeFontMgr(); LOG_ALWAYS_FATAL_IF(fm == nullptr, "Could not load FreeType SkFontMgr"); sk_sp<SkTypeface> typeface = fm->makeFromStream(std::move(fontData)); sk_sp<SkTypeface> typeface = android::makeSkTypeface(std::move(fontData), SkFontArguments()); LOG_ALWAYS_FATAL_IF(typeface == nullptr, "Failed to make typeface from %s", kRobotoFont); std::shared_ptr<minikin::MinikinFont> font = std::make_shared<MinikinFontSkia>( Loading
libs/hwui/jni/FontFamily.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -126,8 +126,7 @@ static bool addSkTypeface(NativeFamilyBuilder* builder, sk_sp<SkData>&& data, in args.setCollectionIndex(ttcIndex); args.setVariationDesignPosition({skVariation.data(), static_cast<int>(skVariation.size())}); sk_sp<SkFontMgr> fm = android::FreeTypeFontMgr(); sk_sp<SkTypeface> face(fm->makeFromStream(std::move(fontData), args)); sk_sp<SkTypeface> face = makeSkTypeface(std::move(fontData), args); if (face == NULL) { ALOGE("addFont failed to create font, invalid request"); builder->axes.clear(); Loading