Module: wine Branch: oldstable Commit: 071c11783763ef8a145c7dd34f7b5ea71c1f08cf URL: http://source.winehq.org/git/wine.git/?a=commit;h=071c11783763ef8a145c7dd34f...
Author: Alexandre Julliard julliard@winehq.org Date: Thu Dec 22 14:23:54 2016 +0100
wineconsole: Leave room for wide characters only when using a DBCS codepage.
Signed-off-by: Alexandre Julliard julliard@winehq.org (cherry picked from commit 29533e4844761c499c16be73e2db7dc055776fdf) Signed-off-by: Michael Stefaniuc mstefani@winehq.org
---
programs/wineconsole/user.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/programs/wineconsole/user.c b/programs/wineconsole/user.c index 40a0757..f119d19 100644 --- a/programs/wineconsole/user.c +++ b/programs/wineconsole/user.c @@ -458,6 +458,7 @@ HFONT WCUSER_CopyFont(struct config_data* config, HWND hWnd, const LOGFONTW* lf, TEXTMETRICW tm; HDC hDC; HFONT hFont, hOldFont; + CPINFO cpinfo;
if (!(hDC = GetDC(hWnd))) return NULL; if (!(hFont = CreateFontIndirectW(lf))) @@ -470,12 +471,16 @@ HFONT WCUSER_CopyFont(struct config_data* config, HWND hWnd, const LOGFONTW* lf, SelectObject(hDC, hOldFont); ReleaseDC(hWnd, hDC);
- config->cell_width = tm.tmMaxCharWidth; + config->cell_width = tm.tmAveCharWidth; config->cell_height = tm.tmHeight + tm.tmExternalLeading; config->font_weight = tm.tmWeight; lstrcpyW(config->face_name, lf->lfFaceName); if (el) *el = tm.tmExternalLeading;
+ /* FIXME: use maximum width for DBCS codepages since some chars take two cells */ + if (GetCPInfo( GetConsoleOutputCP(), &cpinfo ) && cpinfo.MaxCharSize > 1) + config->cell_width = tm.tmMaxCharWidth; + return hFont; }