File chromium-130-fontations.patch of Package nodejs-electron
--- a/skia/BUILD.gn
+++ b/skia/BUILD.gn
@@ -8,7 +8,6 @@ import("//build/config/features.gni")
import("//build/config/freetype/freetype.gni")
import("//build/config/rust.gni")
import("//build/config/sanitizers/sanitizers.gni")
-import("//build/rust/rust_static_library.gni")
import("//gpu/vulkan/features.gni")
import("//skia/skia.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
@@ -37,27 +36,6 @@ buildflag_header("buildflags") {
]
}
-source_set("path_bridge") {
- sources = skia_fontations_path_bridge_sources
-}
-
-rust_static_library("bridge_rust_side") {
- allow_unsafe = true
- crate_root = skia_fontations_bridge_root
- sources = skia_ports_fontations_bridge_rust_side_sources
- cxx_bindings = [ skia_fontations_bridge_root ]
- deps = [
- ":path_bridge",
- "//third_party/rust/font_types/v0_8:lib",
- "//third_party/rust/read_fonts/v0_27:lib",
- "//third_party/rust/skrifa/v0_29:lib",
- ]
- configs -= [ "//build/config/compiler:chromium_code" ]
- configs += [
- ":skia_config",
- "//build/config/compiler:no_chromium_code",
- ]
-}
# External-facing config for dependent code.
config("skia_config") {
@@ -190,7 +168,6 @@ config("skia_library_config") {
if (use_blink && enable_freetype) {
defines += [
"SK_TYPEFACE_FACTORY_FREETYPE",
- "SK_TYPEFACE_FACTORY_FONTATIONS",
"SK_FONTMGR_FREETYPE_EMPTY_AVAILABLE",
]
}
@@ -428,14 +405,6 @@ component("skia") {
public += skia_ports_fontmgr_empty_public
}
sources += skia_ports_typeface_proxy_sources
- sources += skia_ports_typeface_fontations_sources
- sources += skia_ports_fontmgr_fontations_sources
-
- # Fontations Rust/C++ bridge interfaces.
- deps += [
- ":bridge_rust_side",
- ":path_bridge",
- ]
}
if (is_win) {
@@ -730,13 +699,7 @@ skia_source_set("skia_core_and_effects")
# skia_core_and_effects rather than the other way around.
public_deps = [ "//third_party/dawn/include/dawn:cpp_headers" ]
}
- if (use_blink) {
- # Fontations Rust/C++ bridge interfaces, needed by SkTypeface.
- deps += [
- ":bridge_rust_side",
- ":path_bridge",
- ]
- }
+
visibility = [ ":skia" ]
}
--- a/skia/ext/font_utils.cc
+++ b/skia/ext/font_utils.cc
@@ -69,13 +69,7 @@ static sk_sp<SkFontMgr> fontmgr_factory(
return SkFontMgr_New_CoreText(nullptr);
#elif BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
sk_sp<SkFontConfigInterface> fci(SkFontConfigInterface::RefGlobal());
- if (base::FeatureList::IsEnabled(skia::kFontationsLinuxSystemFonts)) {
- return fci ? SkFontMgr_New_FCI(std::move(fci),
- SkFontScanner_Make_Fontations())
- : nullptr;
- } else {
- return fci ? SkFontMgr_New_FCI(std::move(fci)) : nullptr;
- }
+ return fci ? SkFontMgr_New_FCI(std::move(fci)) : nullptr;
#elif BUILDFLAG(IS_FUCHSIA)
fuchsia::fonts::ProviderSyncPtr provider;
base::ComponentContextForProcess()->svc()->Connect(provider.NewRequest());
--- a/third_party/blink/renderer/platform/fonts/skia/sktypeface_factory.cc
+++ b/third_party/blink/renderer/platform/fonts/skia/sktypeface_factory.cc
@@ -29,11 +29,7 @@ sk_sp<SkTypeface> SkTypeface_Factory::Fr
font_identity.fID = config_id;
font_identity.fTTCIndex = ttc_index;
- if (base::FeatureList::IsEnabled(skia::kFontationsLinuxSystemFonts)) {
- return fci->makeTypeface(font_identity, SkFontMgr_New_Fontations_Empty());
- } else {
return fci->makeTypeface(font_identity, skia::DefaultFontMgr());
- }
#else
NOTREACHED();
#endif
@@ -46,12 +42,7 @@ sk_sp<SkTypeface> SkTypeface_Factory::Fr
#if !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_FUCHSIA) && \
!BUILDFLAG(IS_APPLE)
- if (base::FeatureList::IsEnabled(skia::kFontationsLinuxSystemFonts)) {
- return SkFontMgr_New_Fontations_Empty()->makeFromFile(filename.c_str(),
- ttc_index);
- } else {
return skia::DefaultFontMgr()->makeFromFile(filename.c_str(), ttc_index);
- }
#else
NOTREACHED();
#endif
--- a/third_party/blink/renderer/platform/fonts/web_font_typeface_factory.cc
+++ b/third_party/blink/renderer/platform/fonts/web_font_typeface_factory.cc
@@ -12,7 +12,6 @@
#include "third_party/blink/renderer/platform/fonts/opentype/font_format_check.h"
#include "third_party/freetype_buildflags.h"
#include "third_party/skia/include/core/SkTypeface.h"
-#include "third_party/skia/include/ports/SkTypeface_fontations.h"
#if BUILDFLAG(IS_WIN)
#include "third_party/blink/renderer/platform/fonts/win/dwrite_font_format_support.h"
@@ -38,11 +37,7 @@ bool IsWin() {
}
bool IsFreeTypeSystemRasterizer() {
-#if !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_APPLE)
return true;
-#else
- return false;
-#endif
}
sk_sp<SkTypeface> MakeTypefaceDefaultFontMgr(sk_sp<SkData> data) {
@@ -50,13 +45,7 @@ sk_sp<SkTypeface> MakeTypefaceDefaultFon
return FontCache::Get().FontManager()->makeFromData(data, 0);
#endif
-#if BUILDFLAG(IS_APPLE)
return skia::DefaultFontMgr()->makeFromData(data, 0);
-#endif
-
-#if !(BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE))
- return SkTypeface_Make_Fontations(data, SkFontArguments());
-#endif
}
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE)
@@ -65,10 +54,6 @@ sk_sp<SkTypeface> MakeTypefaceFallback(s
}
#endif
-sk_sp<SkTypeface> MakeTypefaceFontations(sk_sp<SkData> data) {
- return SkTypeface_Make_Fontations(data, SkFontArguments());
-}
-
sk_sp<SkTypeface> MakeVariationsTypeface(
sk_sp<SkData> data,
const WebFontTypefaceFactory::FontInstantiator& instantiator) {
@@ -88,9 +73,6 @@ sk_sp<SkTypeface> MakeSbixTypeface(
const WebFontTypefaceFactory::FontInstantiator& instantiator) {
// If we're on a OS with FreeType as backend, or on Windows, where we used to
// use FreeType for SBIX, switch to Fontations for SBIX.
- if (IsFreeTypeSystemRasterizer() || IsWin()) {
- return instantiator.make_fontations(data);
- }
// Remaining case, on Mac, CoreText can handle creating SBIX fonts.
return instantiator.make_system(data);
@@ -99,29 +81,21 @@ sk_sp<SkTypeface> MakeSbixTypeface(
sk_sp<SkTypeface> MakeColrV0Typeface(
sk_sp<SkData> data,
const WebFontTypefaceFactory::FontInstantiator& instantiator) {
- if (IsWin()) {
// On Windows Skia's DirectWrite
// backend handles COLRv0.
return instantiator.make_system(data);
- }
- return instantiator.make_fontations(data);
}
sk_sp<SkTypeface> MakeColrV0VariationsTypeface(
sk_sp<SkData> data,
const WebFontTypefaceFactory::FontInstantiator& instantiator) {
-#if BUILDFLAG(IS_WIN)
- if (DWriteVersionSupportsVariations()) {
return instantiator.make_system(data);
- }
-#endif
- return instantiator.make_fontations(data);
}
sk_sp<SkTypeface> MakeFontationsFallbackPreferred(
sk_sp<SkData> data,
const WebFontTypefaceFactory::FontInstantiator& instantiator) {
- return instantiator.make_fontations(data);
+ return instantiator.make_system(data);
}
} // namespace
@@ -131,7 +105,6 @@ bool WebFontTypefaceFactory::CreateTypef
const FontFormatCheck format_check(data);
const FontInstantiator instantiator = {
MakeTypefaceDefaultFontMgr,
- MakeTypefaceFontations,
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE)
MakeTypefaceFallback,
#endif