Commit d5f7eb30 authored by Dominik Röttsches's avatar Dominik Röttsches Committed by Commit Bot

Include /product/fonts directory in local font matching

Include /product/fonts directory for scanning for local fonts. Since
this is a change in what directories we are indexing, add a suffix to
the Android build fingerprint so that a reindexing is triggered. Because
after this change the previous build fingerprint that was persisted
to the cache file does not match, a reindexing is triggered and the
newly read font metadata is written to the same cache file, overwriting
the old data, and storing it under the suffixed fingerprint.

Manually tested using a page that includes "Google Sans" font using
Google Fonts' CSS and confirming that the local font is used via
DevTools chrome://inspect.

Bug: 939729
Change-Id: Ic190b116c1395aa573382c33d9266af8a75d6535
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2050370Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Dominik Röttsches <drott@chromium.org>
Cr-Commit-Position: refs/heads/master@{#741005}
parent d56b8955
......@@ -29,9 +29,12 @@
namespace {
// Increment this suffix when changes are needed to the cache structure, e.g.
// counting up after the dash "-1", "-2", etc.
const char kFingerprintSuffixForceUpdateCache[] = "-1";
const char kProtobufFilename[] = "font_unique_name_table.pb";
static const char* const kAndroidFontPaths[] = {"/system/fonts",
"/vendor/fonts"};
static const char* const kAndroidFontPaths[] = {
"/system/fonts", "/vendor/fonts", "/product/fonts"};
// These values are logged to UMA. Entries should not be renumbered and
// numeric values should never be reused. Please keep in sync with
......@@ -387,7 +390,9 @@ base::FilePath FontUniqueNameLookup::TableCacheFilePath() {
std::string FontUniqueNameLookup::GetAndroidBuildFingerprint() const {
return android_build_fingerprint_for_testing_.size()
? android_build_fingerprint_for_testing_
: base::android::BuildInfo::GetInstance()->android_build_fp();
: std::string(base::android::BuildInfo::GetInstance()
->android_build_fp()) +
std::string(kFingerprintSuffixForceUpdateCache);
}
std::vector<std::string> FontUniqueNameLookup::GetFontFilePaths() const {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment