diff --git a/src/fonts.c b/src/fonts.c index c633d006f..6e9d75e30 100644 --- a/src/fonts.c +++ b/src/fonts.c @@ -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"); diff --git a/src/win32_print.c b/src/win32_print.c index effaaac01..c3f86c67c 100644 --- a/src/win32_print.c +++ b/src/win32_print.c @@ -598,6 +598,28 @@ char *GetSystemFontDir(void) return strdup("C:\\WINDOWS\\FONTS"); } +/** + * + * Returns heap string containing user font directory. + * (e.g. 'C:\Users\\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. diff --git a/src/win32_print.h b/src/win32_print.h index 5d1dd57a6..4fe19e13e 100644 --- a/src/win32_print.h +++ b/src/win32_print.h @@ -21,6 +21,7 @@ extern int IsPrinterAvailable(void); /* additional windows functions requiring */ 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 */