forked from bromite/bromite
-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
8 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|
@@ -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 + | ||
|
@@ -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 | ||
|
||
|
@@ -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; | ||
|
@@ -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( | ||
|
@@ -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"); | ||
|
||
|
@@ -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); | ||
|