gdi32: Don't call GetObjectW() unless necessary.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2016-07-29 13:13:07 +01:00 committed by Alexandre Julliard
parent 41f763ea87
commit 0c1e42235a

View file

@ -681,13 +681,15 @@ static void update_font_code_page( DC *dc, HANDLE font )
{
CHARSETINFO csi;
int charset = get_text_charset_info( dc, NULL, 0 );
LOGFONTW lf;
GetObjectW( font, sizeof(lf), &lf );
if (charset == ANSI_CHARSET && get_associated_charset_info() & ASSOC_CHARSET_ANSI)
{
LOGFONTW lf;
if (charset == ANSI_CHARSET && !(lf.lfClipPrecision & CLIP_DFA_DISABLE) &&
get_associated_charset_info() & ASSOC_CHARSET_ANSI)
charset = DEFAULT_CHARSET;
GetObjectW( font, sizeof(lf), &lf );
if (!(lf.lfClipPrecision & CLIP_DFA_DISABLE))
charset = DEFAULT_CHARSET;
}
/* Hmm, nicely designed api this one! */
if (TranslateCharsetInfo( ULongToPtr(charset), &csi, TCI_SRCCHARSET) )