Load user's fonts also on Windows.
This commit is contained in:
parent
0b28bf49e4
commit
365ee3ea20
3 changed files with 27 additions and 0 deletions
|
|
@ -598,6 +598,28 @@ char *GetSystemFontDir(void)
|
|||
return strdup("C:\\WINDOWS\\FONTS");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns heap string containing user font directory.
|
||||
* (e.g. 'C:\Users\<username>\AppData\Local\Microsoft\Windows\Fonts')
|
||||
*
|
||||
* @return user font dir
|
||||
*/
|
||||
char *GetUserFontDir(void)
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
const char *key = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
|
||||
const char *option = "Local AppData";
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
if (SUCCEEDED(hr = ReadRegistry(key, option, path, sizeof(path))))
|
||||
{
|
||||
strcat(path, "\\Microsoft\\Windows\\Fonts");
|
||||
return strdup(path);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns heap string containing user's image directory.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue