From 03f8c04ecacdebb745984db51b63d8e52f79c599 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Wed, 16 Aug 2023 12:23:43 +0000 Subject: [PATCH] Bug 1845174 - Don't use variation fonts on Android API versions <= 23. r=gfx-reviewers,lsalzman Differential Revision: https://phabricator.services.mozilla.com/D186242 --- gfx/thebes/gfxAndroidPlatform.cpp | 7 +++++++ gfx/thebes/gfxAndroidPlatform.h | 6 +----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/gfx/thebes/gfxAndroidPlatform.cpp b/gfx/thebes/gfxAndroidPlatform.cpp index 7c7fe11fc62e..88d08df2e33e 100644 --- a/gfx/thebes/gfxAndroidPlatform.cpp +++ b/gfx/thebes/gfxAndroidPlatform.cpp @@ -287,6 +287,13 @@ bool gfxAndroidPlatform::RequiresLinearZoom() { return gfxPlatform::RequiresLinearZoom(); } +bool gfxAndroidPlatform::CheckVariationFontSupport() { + // Don't attempt to use variations on Android API versions up to Marshmallow, + // because the system freetype version is too old and the parent process may + // access it during printing (bug 1845174). + return jni::GetAPIVersion() > 23; +} + class AndroidVsyncSource final : public VsyncSource, public widget::AndroidVsync::Observer { public: diff --git a/gfx/thebes/gfxAndroidPlatform.h b/gfx/thebes/gfxAndroidPlatform.h index 6d028375d49a..598acdb571fb 100644 --- a/gfx/thebes/gfxAndroidPlatform.h +++ b/gfx/thebes/gfxAndroidPlatform.h @@ -40,11 +40,7 @@ class gfxAndroidPlatform final : public gfxPlatform { already_AddRefed CreateGlobalHardwareVsyncSource() override; - static bool CheckVariationFontSupport() { - // We build with in-tree FreeType, so we know it is a new enough - // version to support variations. - return true; - } + static bool CheckVariationFontSupport(); protected: void InitAcceleration() override;