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
|
|
@ -1042,6 +1042,10 @@ char * * malloc_fontconfig_config_paths(int num_to_malloc, int * num_actually_ma
|
|||
#ifdef WIN32
|
||||
homedirdir = GetSystemFontDir();
|
||||
loadfonts(screen, texture, renderer, homedirdir);
|
||||
homedirdir = GetUserFontDir();
|
||||
if (homedirdir != NULL){
|
||||
loadfonts(screen, texture, renderer, homedirdir);
|
||||
}
|
||||
free(homedirdir);
|
||||
#elif defined(__BEOS__)
|
||||
loadfonts(screen, texture, renderer, "/boot/home/config/font/ttffonts");
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ extern int IsPrinterAvailable(void);
|
|||
/* additional windows functions requiring <windows.h> */
|
||||
extern char *GetDefaultSaveDir(const char *suffix);
|
||||
extern char *GetSystemFontDir(void);
|
||||
extern char *GetUserFontDir(void);
|
||||
extern char *get_temp_fname(const char *const name);
|
||||
|
||||
/* keyboard hooking functions */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue