From: Piotr Caban piotr@codeweavers.com
We're checking that type is TRUETYPE_FONTTYPE before calling validate_font_metric. --- programs/conhost/window.c | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-)
diff --git a/programs/conhost/window.c b/programs/conhost/window.c index 9817c5fdac9..9c03bcb2212 100644 --- a/programs/conhost/window.c +++ b/programs/conhost/window.c @@ -806,30 +806,15 @@ struct font_chooser };
/* 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, - DWORD type, int pass ) +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 (type & RASTER_FONTTYPE) return FALSE; - /* fall through */ - case 1: - if (type & RASTER_FONTTYPE) - { - if (tm->tmMaxCharWidth * (console->active->win.right - console->active->win.left + 1) - >= GetSystemMetrics(SM_CXSCREEN)) - return FALSE; - if (tm->tmHeight * (console->active->win.bottom - console->active->win.top + 1) - >= GetSystemMetrics(SM_CYSCREEN)) - return FALSE; - } - /* fall through */ - case 2: if (tm->tmCharSet != DEFAULT_CHARSET && tm->tmCharSet != console->window->ui_charset) return FALSE; /* fall through */ - case 3: + case 1: if (tm->tmItalic || tm->tmUnderlined || tm->tmStruckOut) return FALSE; break; } @@ -842,15 +827,13 @@ static BOOL validate_font( struct console *console, const LOGFONTW *lf, int pass switch (pass) /* we get increasingly lenient in later passes */ { case 0: - case 1: - case 2: if (lf->lfCharSet != DEFAULT_CHARSET && lf->lfCharSet != console->window->ui_charset) return FALSE; /* fall through */ - case 3: + case 1: if ((lf->lfPitchAndFamily & 3) != FIXED_PITCH) return FALSE; /* fall through */ - case 4: + case 2: if (lf->lfFaceName[0] == '@') return FALSE; break; } @@ -872,7 +855,7 @@ static int CALLBACK enum_first_font_proc( const LOGFONTW *lf, const TEXTMETRICW
TRACE( "%s\n", debugstr_textmetric( tm, font_type ));
- if (!validate_font_metric( fc->console, tm, font_type, fc->pass )) + if (!validate_font_metric( fc->console, tm, fc->pass )) return 1;
/* set default font size */ @@ -904,13 +887,13 @@ static void set_first_font( struct console *console, struct console_config *conf fc.font_width = config->cell_width; fc.done = FALSE;
- for (fc.pass = 0; fc.pass <= 5; fc.pass++) + for (fc.pass = 0; fc.pass <= 3; fc.pass++) { EnumFontFamiliesExW( console->window->mem_dc, &lf, enum_first_font_proc, (LPARAM)&fc, 0); if (fc.done) break; }
- if (fc.pass > 5) + if (fc.pass > 3) ERR("Unable to find a valid console font\n");
/* Update active configuration */