From 4f96439ebfb007fdf121f0a6fd889bddff3c8c5b Mon Sep 17 00:00:00 2001 From: Tim Worthington Date: Sat, 22 Jul 2017 01:34:37 +1000 Subject: [PATCH] user32: Fix rendering of tabs in edit control. Signed-off-by: Tim Worthington Signed-off-by: Aric Stewart Signed-off-by: Alexandre Julliard --- dlls/user32/edit.c | 2 +- dlls/usp10/usp10.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c index 78d78ea1f6c..00a7fba756d 100644 --- a/dlls/user32/edit.c +++ b/dlls/user32/edit.c @@ -411,7 +411,7 @@ static SCRIPT_STRING_ANALYSIS EDIT_UpdateUniscribeData_linedef(EDITSTATE *es, HD old_font = SelectObject(udc, es->font); tabdef.cTabStops = es->tabs_count; - tabdef.iScale = 0; + tabdef.iScale = GdiGetCharDimensions(udc, NULL, NULL); tabdef.pTabStops = es->tabs; tabdef.iTabOrigin = 0; diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c index c1d9c1c43e6..a6309ed3537 100644 --- a/dlls/usp10/usp10.c +++ b/dlls/usp10/usp10.c @@ -1828,7 +1828,12 @@ static inline int getGivenTabWidth(ScriptCache *psc, SCRIPT_TABDEF *pTabdef, int cTabStops = 0; } else - defWidth = 8 * psc->tm.tmAveCharWidth; + { + if (pTabdef->iScale) + defWidth = (32 * pTabdef->iScale) / 4; + else + defWidth = 8 * psc->tm.tmAveCharWidth; + } for (; cTabStops>0 ; lpTabPos++, cTabStops--) { @@ -1842,10 +1847,10 @@ static inline int getGivenTabWidth(ScriptCache *psc, SCRIPT_TABDEF *pTabdef, int if( nTabOrg + position > current_x) { - if( *lpTabPos >= 0) + if( position >= 0) { /* a left aligned tab */ - x = (nTabOrg + *lpTabPos) - current_x; + x = (nTabOrg + position) - current_x; break; } else