Hugh McMaster : conhost: Set correct face name when the specified font is not available.
Module: wine Branch: master Commit: 303f8042f9db508adaca02ef21f8de4992cb9c03 URL: https://source.winehq.org/git/wine.git/?a=commit;h=303f8042f9db508adaca02ef2... Author: Hugh McMaster <hugh.mcmaster(a)outlook.com> Date: Tue May 24 23:27:23 2022 +1000 conhost: Set correct face name when the specified font is not available. conhost.exe currently copies the user-specified face name from the LOGFONT structure. This results in an invalid face name when the specified font is not available. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/conhost/window.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/programs/conhost/window.c b/programs/conhost/window.c index 582badf43b5..5e8c3e15a4f 100644 --- a/programs/conhost/window.c +++ b/programs/conhost/window.c @@ -678,6 +678,7 @@ static BOOL set_console_font( struct console *console, const LOGFONTW *logfont ) struct font_info *font_info = &console->active->font; HFONT font, old_font; TEXTMETRICW tm; + WCHAR face_name[LF_FACESIZE]; CPINFO cpinfo; HDC dc; @@ -703,6 +704,7 @@ static BOOL set_console_font( struct console *console, const LOGFONTW *logfont ) old_font = SelectObject( dc, font ); GetTextMetricsW( dc, &tm ); + font_info->face_len = GetTextFaceW( dc, ARRAY_SIZE(face_name), face_name ) - 1; SelectObject( dc, old_font ); ReleaseDC( console->win, dc ); @@ -712,9 +714,8 @@ static BOOL set_console_font( struct console *console, const LOGFONTW *logfont ) font_info->weight = tm.tmWeight; free( font_info->face_name ); - font_info->face_len = wcslen( logfont->lfFaceName ); font_info->face_name = malloc( font_info->face_len * sizeof(WCHAR) ); - memcpy( font_info->face_name, logfont->lfFaceName, font_info->face_len * sizeof(WCHAR) ); + memcpy( font_info->face_name, face_name, font_info->face_len * sizeof(WCHAR) ); /* FIXME: use maximum width for DBCS codepages since some chars take two cells */ if (GetCPInfo( console->output_cp, &cpinfo ) && cpinfo.MaxCharSize == 2)
participants (1)
-
Alexandre Julliard