Cygwin: console: make sure EnumFontFamiliesExW loop isn't infinite
The current loop condition is borderline. Make sure it ends and choose a replacement char in the unlikely case the current console font isn't recognized at all. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
7a720bfe08
commit
d83404e418
|
@ -2016,10 +2016,16 @@ check_font (HANDLE hdl)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
EnumFontFamiliesExW (cdc, &lf, enum_proc, (LPARAM) &done, 0);
|
EnumFontFamiliesExW (cdc, &lf, enum_proc, (LPARAM) &done, 0);
|
||||||
if (!done && cp > lf.lfFaceName)
|
if (!done)
|
||||||
*cp-- = L'\0';
|
*cp-- = L'\0';
|
||||||
}
|
}
|
||||||
while (!done);
|
while (!done && cp >= lf.lfFaceName);
|
||||||
|
/* What, really? No recognizable font? */
|
||||||
|
if (!done)
|
||||||
|
{
|
||||||
|
rp_char = L'?';
|
||||||
|
return;
|
||||||
|
}
|
||||||
/* Yes. Check for the best replacement char. */
|
/* Yes. Check for the best replacement char. */
|
||||||
HFONT f = CreateFontW (0, 0, 0, 0,
|
HFONT f = CreateFontW (0, 0, 0, 0,
|
||||||
cfi.FontWeight, FALSE, FALSE, FALSE,
|
cfi.FontWeight, FALSE, FALSE, FALSE,
|
||||||
|
|
Loading…
Reference in New Issue