gdi32: Allow for loading of multibyte font name replacements.

Change a number of A function to W functions in LoadReplaceList to
allow for replacements of fonts with multibyte family names.
This commit is contained in:
Aric Stewart 2007-02-26 13:12:30 +09:00 committed by Alexandre Julliard
parent b603927c31
commit bc07aff1a5
1 changed files with 11 additions and 12 deletions

View File

@ -1224,43 +1224,42 @@ static void LoadReplaceList(void)
{ {
HKEY hkey; HKEY hkey;
DWORD valuelen, datalen, i = 0, type, dlen, vlen; DWORD valuelen, datalen, i = 0, type, dlen, vlen;
LPSTR value; LPWSTR value;
LPVOID data; LPVOID data;
Family *family; Family *family;
Face *face; Face *face;
struct list *family_elem_ptr, *face_elem_ptr; struct list *family_elem_ptr, *face_elem_ptr;
WCHAR old_nameW[200]; CHAR familyA[400];
/* @@ Wine registry key: HKCU\Software\Wine\Fonts\Replacements */ /* @@ Wine registry key: HKCU\Software\Wine\Fonts\Replacements */
if(RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Fonts\\Replacements", &hkey) == ERROR_SUCCESS) if(RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Fonts\\Replacements", &hkey) == ERROR_SUCCESS)
{ {
RegQueryInfoKeyA(hkey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, RegQueryInfoKeyW(hkey, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
&valuelen, &datalen, NULL, NULL); &valuelen, &datalen, NULL, NULL);
valuelen++; /* returned value doesn't include room for '\0' */ valuelen++; /* returned value doesn't include room for '\0' */
value = HeapAlloc(GetProcessHeap(), 0, valuelen * sizeof(CHAR)); value = HeapAlloc(GetProcessHeap(), 0, valuelen * sizeof(WCHAR));
data = HeapAlloc(GetProcessHeap(), 0, datalen); data = HeapAlloc(GetProcessHeap(), 0, datalen);
dlen = datalen; dlen = datalen;
vlen = valuelen; vlen = valuelen;
while(RegEnumValueA(hkey, i++, value, &vlen, NULL, &type, data, while(RegEnumValueW(hkey, i++, value, &vlen, NULL, &type, data,
&dlen) == ERROR_SUCCESS) { &dlen) == ERROR_SUCCESS) {
TRACE("Got %s=%s\n", debugstr_a(value), debugstr_a(data)); TRACE("Got %s=%s\n", debugstr_w(value), debugstr_w(data));
/* "NewName"="Oldname" */ /* "NewName"="Oldname" */
if(!MultiByteToWideChar(CP_ACP, 0, data, -1, old_nameW, sizeof(old_nameW)/sizeof(WCHAR))) WideCharToMultiByte(CP_ACP, 0, value, -1, familyA, sizeof(familyA), NULL, NULL);
break;
/* Find the old family and hence all of the font files /* Find the old family and hence all of the font files
in that family */ in that family */
LIST_FOR_EACH(family_elem_ptr, &font_list) { LIST_FOR_EACH(family_elem_ptr, &font_list) {
family = LIST_ENTRY(family_elem_ptr, Family, entry); family = LIST_ENTRY(family_elem_ptr, Family, entry);
if(!strcmpiW(family->FamilyName, old_nameW)) { if(!strcmpiW(family->FamilyName, data)) {
LIST_FOR_EACH(face_elem_ptr, &family->faces) { LIST_FOR_EACH(face_elem_ptr, &family->faces) {
face = LIST_ENTRY(face_elem_ptr, Face, entry); face = LIST_ENTRY(face_elem_ptr, Face, entry);
TRACE("mapping %s %s to %s\n", debugstr_w(family->FamilyName), TRACE("mapping %s %s to %s\n", debugstr_w(family->FamilyName),
debugstr_w(face->StyleName), value); debugstr_w(face->StyleName), familyA);
/* Now add a new entry with the new family name */ /* Now add a new entry with the new family name */
AddFontFileToList(face->file, value, ADDFONT_FORCE_BITMAP | (face->external ? ADDFONT_EXTERNAL_FONT : 0)); AddFontFileToList(face->file, familyA, ADDFONT_FORCE_BITMAP | (face->external ? ADDFONT_EXTERNAL_FONT : 0));
} }
break; break;
} }