Moved all font config parameters to HKCU\Software\Wine\Fonts.

Replaced the FontDirs key enumeration by a simple Path value.
This commit is contained in:
Alexandre Julliard 2005-06-14 12:33:19 +00:00
parent eacd06264e
commit 9ad3a97acb
1 changed files with 37 additions and 35 deletions

View File

@ -284,7 +284,7 @@ static const WCHAR *SystemFontValues[4] = {
NULL NULL
}; };
static const WCHAR external_fonts_reg_key[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\','W','i','n','e','\\', static const WCHAR external_fonts_reg_key[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\',
'F','o','n','t','s','\\','E','x','t','e','r','n','a','l',' ','F','o','n','t','s','\0'}; 'F','o','n','t','s','\\','E','x','t','e','r','n','a','l',' ','F','o','n','t','s','\0'};
static const WCHAR ArabicW[] = {'A','r','a','b','i','c','\0'}; static const WCHAR ArabicW[] = {'A','r','a','b','i','c','\0'};
@ -737,7 +737,7 @@ static void LoadSubstList(void)
* The replacement list is a way to map an entire font * The replacement list is a way to map an entire font
* family onto another family. For example adding * family onto another family. For example adding
* *
* [HKLM\Software\Wine\Wine\FontReplacements] * [HKCU\Software\Wine\Fonts\Replacements]
* "Wingdings"="Winedings" * "Wingdings"="Winedings"
* *
* would enumerate the Winedings font both as Winedings and * would enumerate the Winedings font both as Winedings and
@ -756,11 +756,9 @@ static void LoadReplaceList(void)
struct list *family_elem_ptr, *face_elem_ptr; struct list *family_elem_ptr, *face_elem_ptr;
WCHAR old_nameW[200]; WCHAR old_nameW[200];
/* @@ Wine registry key: HKLM\Software\Wine\Wine\FontReplacements */ /* @@ Wine registry key: HKCU\Software\Wine\Fonts\Replacements */
if(RegOpenKeyA(HKEY_LOCAL_MACHINE, if(RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Fonts\\Replacements", &hkey) == ERROR_SUCCESS)
"Software\\Wine\\Wine\\FontReplacements", {
&hkey) == ERROR_SUCCESS) {
RegQueryInfoKeyA(hkey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, RegQueryInfoKeyA(hkey, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
&valuelen, &datalen, NULL, NULL); &valuelen, &datalen, NULL, NULL);
@ -956,9 +954,8 @@ static void update_reg_entries(void)
ERR("Can't create Windows font reg key\n"); ERR("Can't create Windows font reg key\n");
goto end; goto end;
} }
/* @@ Wine registry key: HKLM\Software\Wine\Wine\Fonts\ExternalFonts */ /* @@ Wine registry key: HKCU\Software\Wine\Fonts\ExternalFonts */
if(RegCreateKeyExW(HKEY_LOCAL_MACHINE, external_fonts_reg_key, if(RegCreateKeyW(HKEY_CURRENT_USER, external_fonts_reg_key, &externalkey) != ERROR_SUCCESS) {
0, NULL, 0, KEY_ALL_ACCESS, NULL, &externalkey, NULL) != ERROR_SUCCESS) {
ERR("Can't create external font reg key\n"); ERR("Can't create external font reg key\n");
goto end; goto end;
} }
@ -1078,6 +1075,7 @@ BOOL WineEngRemoveFontResourceEx(LPCWSTR file, DWORD flags, PVOID pdv)
BOOL WineEngInit(void) BOOL WineEngInit(void)
{ {
static const WCHAR dot_fonW[] = {'.','f','o','n','\0'}; static const WCHAR dot_fonW[] = {'.','f','o','n','\0'};
static const WCHAR pathW[] = {'P','a','t','h',0};
HKEY hkey; HKEY hkey;
DWORD valuelen, datalen, i = 0, type, dlen, vlen; DWORD valuelen, datalen, i = 0, type, dlen, vlen;
LPVOID data; LPVOID data;
@ -1222,32 +1220,36 @@ BOOL WineEngInit(void)
load_fontconfig_fonts(); load_fontconfig_fonts();
/* then look in any directories that we've specified in the config file */ /* then look in any directories that we've specified in the config file */
/* @@ Wine registry key: HKLM\Software\Wine\Wine\Config\FontDirs */ /* @@ Wine registry key: HKCU\Software\Wine\Fonts */
if(RegOpenKeyA(HKEY_LOCAL_MACHINE, if(RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Fonts", &hkey) == ERROR_SUCCESS)
"Software\\Wine\\Wine\\Config\\FontDirs", {
&hkey) == ERROR_SUCCESS) { DWORD len;
LPSTR value; LPWSTR valueW;
RegQueryInfoKeyA(hkey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, LPSTR valueA, ptr;
&valuelen, &datalen, NULL, NULL);
valuelen++; /* returned value doesn't include room for '\0' */ if (RegQueryValueExW( hkey, pathW, NULL, NULL, NULL, &len ) == ERROR_SUCCESS)
value = HeapAlloc(GetProcessHeap(), 0, valuelen); {
data = HeapAlloc(GetProcessHeap(), 0, datalen); len += sizeof(WCHAR);
valueW = HeapAlloc( GetProcessHeap(), 0, len );
dlen = datalen; if (RegQueryValueExW( hkey, pathW, NULL, NULL, (LPBYTE)valueW, &len ) == ERROR_SUCCESS)
vlen = valuelen; {
i = 0; len = WideCharToMultiByte( CP_UNIXCP, 0, valueW, -1, NULL, 0, NULL, NULL );
while(RegEnumValueA(hkey, i++, value, &vlen, NULL, &type, data, valueA = HeapAlloc( GetProcessHeap(), 0, len );
&dlen) == ERROR_SUCCESS) { WideCharToMultiByte( CP_UNIXCP, 0, valueW, -1, valueA, len, NULL, NULL );
TRACE("Got %s=%s\n", value, (LPSTR)data); TRACE( "got font path %s\n", debugstr_a(valueA) );
ReadFontDir((LPSTR)data, TRUE); ptr = valueA;
/* reset dlen and vlen */ while (ptr)
dlen = datalen; {
vlen = valuelen; LPSTR next = strchr( ptr, ':' );
} if (next) *next++ = 0;
HeapFree(GetProcessHeap(), 0, data); ReadFontDir( ptr, TRUE );
HeapFree(GetProcessHeap(), 0, value); ptr = next;
RegCloseKey(hkey); }
HeapFree( GetProcessHeap(), 0, valueA );
}
HeapFree( GetProcessHeap(), 0, valueW );
}
RegCloseKey(hkey);
} }
DumpFontList(); DumpFontList();