forked from mia/Aegisub
Search user fonts in GDI font lister
Windows now allow user install fonts without admin. List HKCU for those fonts. https://blogs.windows.com/windowsexperience/2018/06/27/announcing-windows-10-insider-preview-build-17704/
This commit is contained in:
parent
bd4c7789cf
commit
7c500a096a
1 changed files with 22 additions and 20 deletions
|
@ -66,9 +66,10 @@ std::vector<agi::fs::path> get_installed_fonts() {
|
||||||
|
|
||||||
std::vector<agi::fs::path> files;
|
std::vector<agi::fs::path> files;
|
||||||
|
|
||||||
|
for (HKEY hKey : { HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE }) {
|
||||||
HKEY key;
|
HKEY key;
|
||||||
auto ret = RegOpenKeyExW(HKEY_LOCAL_MACHINE, fonts_key_name, 0, KEY_QUERY_VALUE, &key);
|
auto ret = RegOpenKeyExW(hKey, fonts_key_name, 0, KEY_QUERY_VALUE, &key);
|
||||||
if (ret != ERROR_SUCCESS) return files;
|
if (ret != ERROR_SUCCESS) continue;
|
||||||
BOOST_SCOPE_EXIT_ALL(= ) { RegCloseKey(key); };
|
BOOST_SCOPE_EXIT_ALL(= ) { RegCloseKey(key); };
|
||||||
|
|
||||||
wchar_t fdir[MAX_PATH];
|
wchar_t fdir[MAX_PATH];
|
||||||
|
@ -85,10 +86,11 @@ std::vector<agi::fs::path> get_installed_fonts() {
|
||||||
if (ret != ERROR_SUCCESS) continue;
|
if (ret != ERROR_SUCCESS) continue;
|
||||||
|
|
||||||
agi::fs::path font_path(font_filename);
|
agi::fs::path font_path(font_filename);
|
||||||
if (!agi::fs::FileExists(font_path))
|
if (!agi::fs::FileExists(font_path) && agi::fs::FileExists(font_dir / font_path))
|
||||||
font_path = font_dir / font_path;
|
font_path = font_dir / font_path;
|
||||||
files.push_back(font_path);
|
files.push_back(font_path);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return files;
|
return files;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue