Commit 33eadd39 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Don't assume that the font codepages change with the user locale.

Codepages can be set independently with LC_CTYPE.
parent ec7f2f88
......@@ -1558,36 +1558,35 @@ static void add_font_list(HKEY hkey, const struct nls_update_font_list *fl)
static void update_font_info(void)
{
char buf[80];
char buf[40], cpbuf[40];
DWORD len, type;
HKEY hkey = 0;
UINT i, ansi_cp = 0, oem_cp = 0;
LCID lcid = GetUserDefaultLCID();
if (RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Fonts", &hkey) != ERROR_SUCCESS)
return;
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IDEFAULTANSICODEPAGE|LOCALE_RETURN_NUMBER|LOCALE_NOUSEROVERRIDE,
(WCHAR *)&ansi_cp, sizeof(ansi_cp)/sizeof(WCHAR));
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IDEFAULTCODEPAGE|LOCALE_RETURN_NUMBER|LOCALE_NOUSEROVERRIDE,
(WCHAR *)&oem_cp, sizeof(oem_cp)/sizeof(WCHAR));
sprintf( cpbuf, "%u,%u", ansi_cp, oem_cp );
len = sizeof(buf);
if (RegQueryValueExA(hkey, "Locale", 0, &type, (BYTE *)buf, &len) == ERROR_SUCCESS && type == REG_SZ)
if (RegQueryValueExA(hkey, "Codepages", 0, &type, (BYTE *)buf, &len) == ERROR_SUCCESS && type == REG_SZ)
{
if (strtoul(buf, NULL, 16 ) == lcid) /* already set correctly */
if (!strcmp( buf, cpbuf )) /* already set correctly */
{
RegCloseKey(hkey);
return;
}
TRACE("updating registry, locale changed %s -> %08x\n", debugstr_a(buf), lcid);
TRACE("updating registry, codepages changed %s -> %u,%u\n", buf, ansi_cp, oem_cp);
}
else TRACE("updating registry, locale changed none -> %08x\n", lcid);
else TRACE("updating registry, codepages changed none -> %u,%u\n", ansi_cp, oem_cp);
sprintf(buf, "%08x", lcid);
RegSetValueExA(hkey, "Locale", 0, REG_SZ, (const BYTE *)buf, strlen(buf)+1);
RegSetValueExA(hkey, "Codepages", 0, REG_SZ, (const BYTE *)cpbuf, strlen(cpbuf)+1);
RegCloseKey(hkey);
GetLocaleInfoW(lcid, LOCALE_IDEFAULTANSICODEPAGE|LOCALE_RETURN_NUMBER|LOCALE_NOUSEROVERRIDE,
(WCHAR *)&ansi_cp, sizeof(ansi_cp)/sizeof(WCHAR));
GetLocaleInfoW(lcid, LOCALE_IDEFAULTCODEPAGE|LOCALE_RETURN_NUMBER|LOCALE_NOUSEROVERRIDE,
(WCHAR *)&oem_cp, sizeof(oem_cp)/sizeof(WCHAR));
for (i = 0; i < sizeof(nls_update_font_list)/sizeof(nls_update_font_list[0]); i++)
{
if (nls_update_font_list[i].ansi_cp == ansi_cp &&
......@@ -1612,7 +1611,7 @@ static void update_font_info(void)
return;
}
}
FIXME("there is no font defaults for lcid %04x/ansi_cp %u\n", lcid, ansi_cp);
FIXME("there is no font defaults for codepages %u,%u\n", ansi_cp, oem_cp);
}
/*************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment