Module: wine Branch: master Commit: 80a29e2d31d3e1245cf1261f99c70a0fc3e26c3c URL: http://source.winehq.org/git/wine.git/?a=commit;h=80a29e2d31d3e1245cf1261f99...
Author: Huw Davies huw@codeweavers.com Date: Tue Jun 10 09:48:38 2014 +0100
gdi32: CLIP_DFA_DISABLE should disable the font association mechanism.
---
dlls/gdi32/font.c | 9 ++++++--- dlls/gdi32/tests/font.c | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 66072af..af3ea5b 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -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 ); diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c index e978166..dd63297 100644 --- a/dlls/gdi32/tests/font.c +++ b/dlls/gdi32/tests/font.c @@ -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); } }