0

Instantiate Android system fonts with Fontations

After Julia landed [1] (thank you!), it's now possible to create
Fontations Android system fonts.

Create a base feature "FontationsAndroidSystemFonts" to set the Android
default font manager to one that instantiates through Fontations.

In the first patchset/upload, enable the feature by default to do one
round of testing on bots.

[1] https://chromium.googlesource.com/skia.git/+/eb9fc76e302f873de982cefa7690443e7a2cede5

Bug: chromium:370816214
Change-Id: Ieee9828fd5569289e726a45211c489c25e99a2aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6079955
Commit-Queue: Dominik Röttsches <drott@chromium.org>
Auto-Submit: Dominik Röttsches <drott@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
Cr-Commit-Position: refs/heads/main@{#1435391}
This commit is contained in:
Dominik Röttsches
2025-03-20 07:29:34 -07:00
committed by Chromium LUCI CQ
parent d5a269019d
commit 1f4d0f8635
6 changed files with 13 additions and 1 deletions

Binary file not shown.

Before

(image error) Size: 8.8 KiB

After

(image error) Size: 7.6 KiB

Binary file not shown.

Before

(image error) Size: 6.0 KiB

After

(image error) Size: 5.4 KiB

Binary file not shown.

Before

(image error) Size: 5.5 KiB

After

(image error) Size: 5.4 KiB

@ -14,6 +14,7 @@
#if BUILDFLAG(IS_ANDROID)
#include "third_party/skia/include/ports/SkFontMgr_android.h"
#include "third_party/skia/include/ports/SkFontScanner_Fontations.h"
#endif
#if BUILDFLAG(IS_APPLE)
@ -59,7 +60,11 @@ static sk_sp<SkFontMgr> fontmgr_factory() {
return sk_ref_sp(g_fontmgr_override);
}
#if BUILDFLAG(IS_ANDROID)
return SkFontMgr_New_Android(nullptr);
if (base::FeatureList::IsEnabled(skia::kFontationsAndroidSystemFonts)) {
return SkFontMgr_New_Android(nullptr, SkFontScanner_Make_Fontations());
} else {
return SkFontMgr_New_Android(nullptr);
}
#elif BUILDFLAG(IS_APPLE)
return SkFontMgr_New_CoreText(nullptr);
#elif BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)

@ -11,4 +11,10 @@ BASE_FEATURE(kFontationsLinuxSystemFonts,
"FontationsLinuxSystemFonts",
base::FEATURE_ENABLED_BY_DEFAULT);
// Instantiate system fonts on Android with Fontations, affects
// SkFontMgr instantiation in skia/ext/font_utils.cc
BASE_FEATURE(kFontationsAndroidSystemFonts,
"FontationsAndroidSystemFonts",
base::FEATURE_ENABLED_BY_DEFAULT);
} // namespace skia

@ -12,6 +12,7 @@ namespace skia {
SK_API BASE_DECLARE_FEATURE(kFontationsLinuxSystemFonts);
SK_API BASE_DECLARE_FEATURE(kFontationsAndroidSystemFonts);
}
#endif // SKIA_FONTATIONS_FEATURE_H_