Skip to content

Commit

Permalink
Fix linux build
Browse files Browse the repository at this point in the history
  • Loading branch information
uazo committed Apr 12, 2024
1 parent b6c20c4 commit fcf48f9
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions build/patches/Embed-System-Fonts-on-Android.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
From: uazo <[email protected]>
Date: Wed, 10 Apr 2024 15:38:14 +0000
Subject: Embed System Fonts on Android

Expand All @@ -10,7 +9,7 @@ License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html
.../browser/component_updater/registration.cc | 7 ++
chrome/renderer/BUILD.gn | 3 +
components/services/font/BUILD.gn | 11 +++
components/services/font/font_service_app.cc | 43 ++++++++
components/services/font/font_service_app.cc | 45 +++++++++
components/services/font/font_service_app.h | 1 +
.../services/font/public/cpp/font_loader.cc | 11 +++
.../services/font/public/cpp/font_loader.h | 1 +
Expand All @@ -32,7 +31,7 @@ License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html
.../skia/src/ports/SkFontMgr_android.cpp | 45 ++++++---
.../src/ports/SkFontMgr_android_parser.cpp | 37 +++++--
.../skia/src/ports/SkFontMgr_android_parser.h | 2 +
28 files changed, 507 insertions(+), 27 deletions(-)
28 files changed, 509 insertions(+), 27 deletions(-)
create mode 100644 chrome/browser/component_updater/fonts_pack_component_installer.cc
create mode 100644 chrome/browser/component_updater/fonts_pack_component_installer.h

Expand Down Expand Up @@ -321,12 +320,13 @@ diff --git a/components/services/font/font_service_app.cc b/components/services/
}

void FontServiceApp::OpenStream(uint32_t id_number,
@@ -172,12 +181,41 @@ void FontServiceApp::OpenStream(uint32_t id_number,
@@ -172,12 +181,43 @@ void FontServiceApp::OpenStream(uint32_t id_number,
std::move(callback).Run(std::move(file));
}

+void FontServiceApp::OpenStreamFromName(const std::string& name,
+ OpenStreamCallback callback) {
+#if BUILDFLAG(IS_ANDROID)
+ TRACE_EVENT0("fonts", "FontServiceApp::OpenStreamFromName");
+
+ base::File empty_file;
Expand All @@ -349,6 +349,7 @@ diff --git a/components/services/font/font_service_app.cc b/components/services/
+
+ base::File font_file(local_install_path, base::File::FLAG_OPEN | base::File::FLAG_READ);
+ std::move(callback).Run(std::move(font_file));
+#endif
+}
+
void FontServiceApp::FallbackFontForCharacter(
Expand All @@ -363,15 +364,15 @@ diff --git a/components/services/font/font_service_app.cc b/components/services/
gfx::FallbackFontData fallback_font;
if (gfx::GetFallbackFontForChar(character, locale, &fallback_font)) {
size_t index = FindOrAddPath(fallback_font.filepath);
@@ -192,6 +230,7 @@ void FontServiceApp::FallbackFontForCharacter(
@@ -192,6 +232,7 @@ void FontServiceApp::FallbackFontForCharacter(
} else {
std::move(callback).Run(nullptr, "", false, false);
}
+#endif
}

void FontServiceApp::FontRenderStyleForStrike(
@@ -235,6 +274,9 @@ void FontServiceApp::MatchFontByPostscriptNameOrFullFontName(
@@ -235,6 +276,9 @@ void FontServiceApp::MatchFontByPostscriptNameOrFullFontName(
TRACE_EVENT0("fonts",
"FontServiceApp::MatchFontByPostscriptNameOrFullFontName");

Expand All @@ -381,7 +382,7 @@ diff --git a/components/services/font/font_service_app.cc b/components/services/
std::optional<FontConfigLocalMatching::FontConfigMatchResult> match_result =
FontConfigLocalMatching::FindFontByPostscriptNameOrFullFontName(family);
if (match_result) {
@@ -246,6 +288,7 @@ void FontServiceApp::MatchFontByPostscriptNameOrFullFontName(
@@ -246,6 +290,7 @@ void FontServiceApp::MatchFontByPostscriptNameOrFullFontName(
return;
}
std::move(callback).Run(nullptr);
Expand Down

0 comments on commit fcf48f9

Please sign in to comment.