Commit 80a29e2d authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

gdi32: CLIP_DFA_DISABLE should disable the font association mechanism.

parent 2de2e10d
......@@ -653,12 +653,15 @@ static DWORD get_associated_charset_info(void)
return associated_charset;
}
static void update_font_code_page( DC *dc )
static void update_font_code_page( DC *dc, HANDLE font )
{
CHARSETINFO csi;
int charset = GetTextCharsetInfo( dc->hSelf, NULL, 0 );
LOGFONTW lf;
GetObjectW( font, sizeof(lf), &lf );
if (charset == ANSI_CHARSET &&
if (charset == ANSI_CHARSET && !(lf.lfClipPrecision & CLIP_DFA_DISABLE) &&
get_associated_charset_info() & ASSOC_CHARSET_ANSI)
charset = DEFAULT_CHARSET;
......@@ -725,7 +728,7 @@ static HGDIOBJ FONT_SelectObject( HGDIOBJ handle, HDC hdc )
ret = dc->hFont;
dc->hFont = handle;
dc->aa_flags = aa_flags ? aa_flags : GGO_BITMAP;
update_font_code_page( dc );
update_font_code_page( dc, handle );
GDI_dec_ref_count( ret );
}
else GDI_dec_ref_count( handle );
......
......@@ -2570,6 +2570,22 @@ static void test_GdiGetCodePage(void)
hfont = SelectObject(hdc, hfont);
DeleteObject(hfont);
/* CLIP_DFA_DISABLE turns off the font association */
lf.lfClipPrecision = CLIP_DFA_DISABLE;
hfont = CreateFontIndirectA(&lf);
ok(hfont != 0, "CreateFontIndirectA error %u\n", GetLastError());
hfont = SelectObject(hdc, hfont);
charset = GetTextCharset(hdc);
codepage = pGdiGetCodePage(hdc);
trace("acp=%d, lfFaceName=%s, lfCharSet=%d, GetTextCharset=%d, GdiGetCodePage=%d\n",
acp, lf.lfFaceName, lf.lfCharSet, charset, codepage);
ok(codepage == 1252, "GdiGetCodePage returned %d\n", codepage);
hfont = SelectObject(hdc, hfont);
DeleteObject(hfont);
ReleaseDC(NULL, hdc);
}
}
......
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