TL;DR: I am from Google Nest team, which is downstream of chromium project. I ran into this issue that some fonts can be loaded using FcConfigAppFontAddDir, but not available in CSS through local("Google Sans"). How can I debug this?
Hi,
If you don't have access to any of the below links, please let me know.
Our code loads additional fonts when booting up (
code). I applied the following patch and ensured fonts are loaded correctly.
--- a/chromecast/browser/cast_browser_main_parts.cc
+++ b/chromecast/browser/cast_browser_main_parts.cc
@@ -451,9 +451,13 @@ void CastBrowserMainParts::ToolkitInitialized() {
FcInit();
const FcChar8 *dir_font_char8 = reinterpret_cast<const FcChar8*>(dir_font.value().data());
+ LOG(INFO) << "clkbp Loading from " << dir_font_char8;
if (FcConfigAppFontAddDir(nullptr, dir_font_char8) == FcFalse) {
LOG(ERROR) << "Cannot load fonts from " << dir_font_char8;
}
+ auto* font_set = FcConfigGetFonts(nullptr, FcSetApplication);
+ FcFontSetPrint(font_set);
+ LOG(INFO) << "clkbp Loaded from " << dir_font_char8;
#endif
}
logs attached as font_load_log.txt
Then I try to use it in CSS file with local("Google Sans") but the browser cannot render with correct fonts.
I cannot reproduce it in chrome browser, and it would be too complicated for you to reproduce. So may I ask the path from CSS to fontconfig? especially
1. how CSS looks for available fonts in fontconfig
2. how CSS falls back to other fonts
Thank you!
--
Best,
Linkun Chen
If you get an email from me outside of the 9-5, it is not because I am always on or expect an immediate response from you; it is because work flexibility is key for me. Evening and weekend emails are a sign that I prioritized personal obligations or had trouble focusing during the day and took a break from work for a few hours.