Loading build/patches/Embed-System-Fonts-on-Android.patch +8 −7 Original line number Diff line number Diff line From: uazo <uazo@users.noreply.github.com> Date: Wed, 10 Apr 2024 15:38:14 +0000 Subject: Embed System Fonts on Android Loading @@ -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 + Loading @@ -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 Loading Loading @@ -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; Loading @@ -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( Loading @@ -363,7 +364,7 @@ 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); } Loading @@ -371,7 +372,7 @@ diff --git a/components/services/font/font_service_app.cc b/components/services/ } void FontServiceApp::FontRenderStyleForStrike( @@ -235,6 +274,9 @@ void FontServiceApp::MatchFontByPostscriptNameOrFullFontName( @@ -235,6 +276,9 @@ void FontServiceApp::MatchFontByPostscriptNameOrFullFontName( TRACE_EVENT0("fonts", "FontServiceApp::MatchFontByPostscriptNameOrFullFontName"); Loading @@ -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); Loading Loading
build/patches/Embed-System-Fonts-on-Android.patch +8 −7 Original line number Diff line number Diff line From: uazo <uazo@users.noreply.github.com> Date: Wed, 10 Apr 2024 15:38:14 +0000 Subject: Embed System Fonts on Android Loading @@ -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 + Loading @@ -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 Loading Loading @@ -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; Loading @@ -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( Loading @@ -363,7 +364,7 @@ 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); } Loading @@ -371,7 +372,7 @@ diff --git a/components/services/font/font_service_app.cc b/components/services/ } void FontServiceApp::FontRenderStyleForStrike( @@ -235,6 +274,9 @@ void FontServiceApp::MatchFontByPostscriptNameOrFullFontName( @@ -235,6 +276,9 @@ void FontServiceApp::MatchFontByPostscriptNameOrFullFontName( TRACE_EVENT0("fonts", "FontServiceApp::MatchFontByPostscriptNameOrFullFontName"); Loading @@ -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); Loading