gdi32: CLIP_DFA_DISABLE should disable the font association mechanism.

This commit is contained in:
Huw Davies 2014-06-10 09:48:38 +01:00 committed by Alexandre Julliard
parent 2de2e10d47
commit 80a29e2d31
2 changed files with 22 additions and 3 deletions

View File

@ -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;
if (charset == ANSI_CHARSET &&
GetObjectW( font, sizeof(lf), &lf );
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 );

View File

@ -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);
}
}