mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1197717 - Load fonts from profile-agnostic writable location. r=jfkthame
In addition to the system's font folder and the profile folder we will try to load fonts from NS_XPCOM_CURRENT_PROCESS_DIR/fonts. This will allow us to later download fonts at runtime and use them independently from the current profile.
This commit is contained in:
parent
5447c726f5
commit
1a9a056a0f
@ -1205,6 +1205,22 @@ gfxFT2FontList::FindFonts()
|
||||
FindFontsInOmnijar(&fnc);
|
||||
}
|
||||
|
||||
// Look for downloaded fonts in a profile-agnostic "fonts" directory.
|
||||
nsCOMPtr<nsIProperties> dirSvc =
|
||||
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID);
|
||||
if (dirSvc) {
|
||||
nsCOMPtr<nsIFile> appDir;
|
||||
nsresult rv = dirSvc->Get(NS_XPCOM_CURRENT_PROCESS_DIR,
|
||||
NS_GET_IID(nsIFile), getter_AddRefs(appDir));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
appDir->AppendNative(NS_LITERAL_CSTRING("fonts"));
|
||||
nsCString localPath;
|
||||
if (NS_SUCCEEDED(appDir->GetNativePath(localPath))) {
|
||||
FindFontsInDir(localPath, &fnc, FT2FontFamily::kVisible);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// look for locally-added fonts in a "fonts" subdir of the profile
|
||||
nsCOMPtr<nsIFile> localDir;
|
||||
nsresult rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_LOCAL_50_DIR,
|
||||
|
Loading…
Reference in New Issue
Block a user