From: Piotr Caban piotr@codeweavers.com
--- programs/conhost/window.c | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-)
diff --git a/programs/conhost/window.c b/programs/conhost/window.c index 9c03bcb2212..ba96729314d 100644 --- a/programs/conhost/window.c +++ b/programs/conhost/window.c @@ -805,33 +805,20 @@ struct font_chooser BOOL done; };
-/* check if the font described in tm is usable as a font for the renderer */ -static BOOL validate_font_metric( struct console *console, const TEXTMETRICW *tm, int pass ) -{ - switch (pass) /* we get increasingly lenient in later passes */ - { - case 0: - if (tm->tmCharSet != DEFAULT_CHARSET && tm->tmCharSet != console->window->ui_charset) - return FALSE; - /* fall through */ - case 1: - if (tm->tmItalic || tm->tmUnderlined || tm->tmStruckOut) return FALSE; - break; - } - return TRUE; -} - /* check if the font family described in lf is usable as a font for the renderer */ -static BOOL validate_font( struct console *console, const LOGFONTW *lf, int pass ) +static BOOL validate_font( struct console *console, const LOGFONTW *lf, const TEXTMETRICW *tm, int pass ) { switch (pass) /* we get increasingly lenient in later passes */ { case 0: if (lf->lfCharSet != DEFAULT_CHARSET && lf->lfCharSet != console->window->ui_charset) return FALSE; + if (tm && tm->tmCharSet != DEFAULT_CHARSET && tm->tmCharSet != console->window->ui_charset) + return FALSE; /* fall through */ case 1: if ((lf->lfPitchAndFamily & 3) != FIXED_PITCH) return FALSE; + if (tm && (tm->tmItalic || tm->tmUnderlined || tm->tmStruckOut)) return FALSE; /* fall through */ case 2: if (lf->lfFaceName[0] == '@') return FALSE; @@ -849,13 +836,9 @@ static int CALLBACK enum_first_font_proc( const LOGFONTW *lf, const TEXTMETRICW if (font_type != TRUETYPE_FONTTYPE) return 1;
TRACE( "%s\n", debugstr_logfont( lf, font_type )); - - if (!validate_font( fc->console, lf, fc->pass )) - return 1; - TRACE( "%s\n", debugstr_textmetric( tm, font_type ));
- if (!validate_font_metric( fc->console, tm, fc->pass )) + if (!validate_font( fc->console, lf, tm, fc->pass )) return 1;
/* set default font size */ @@ -1589,7 +1572,7 @@ static int CALLBACK enum_list_font_proc( const LOGFONTW *lf, const TEXTMETRICW *
TRACE( "%s\n", debugstr_logfont( lf, font_type ));
- if (validate_font( di->console, lf, 0 )) + if (validate_font( di->console, lf, NULL, 0 )) SendDlgItemMessageW( di->dialog, IDC_FNT_LIST_FONT, LB_ADDSTRING, 0, (LPARAM)lf->lfFaceName );
return 1;