Added GetSystemFontDir() and amended WIN32 code so that the system fonts
option work correctly on Windows. Modified the text gadget so that it correctly handles the 16-bit unicode characters that SDL sends. The text buffer is held internally as an array of wchar_t, and makes uses of various wide-character functions. It is converted back into 16-bit unicode characters to satisfy SDL_ttf. Tested on Windows and Linux.
This commit is contained in:
parent
9241a0f507
commit
304f49672b
3 changed files with 93 additions and 13 deletions
|
|
@ -533,4 +533,23 @@ char *GetDefaultSaveDir(const char *suffix)
|
|||
return strdup("userdata");
|
||||
}
|
||||
|
||||
/*
|
||||
Returns heap string containing system font directory.
|
||||
E.g. 'C:\Windows\Fonts'
|
||||
*/
|
||||
char *GetSystemFontDir()
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
const char *key = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
|
||||
const char *option = "Fonts";
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
if (SUCCEEDED(hr = ReadRegistry(key, option, path, sizeof(path))))
|
||||
{
|
||||
remove_slash(path);
|
||||
return strdup(path);
|
||||
}
|
||||
return strdup("C:\\WINDOWS\\FONTS");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue