Commit 209820c4 authored by Ulrich Czekalla's avatar Ulrich Czekalla Committed by Alexandre Julliard

user32: Don't scale draw text margin params by character width units.

Values passed in DRAWTEXTPARAMS are already in average character width units.
parent a1f05593
......@@ -316,6 +316,23 @@ static void test_DrawTextCalcRect(void)
ok(textheight==0,"Got textheight from DrawTextExA\n");
ok(dtp.uiLengthDrawn==1337, "invalid dtp.uiLengthDrawn = %i\n",dtp.uiLengthDrawn);
/* Margin calculations */
dtp.cbSize = sizeof(dtp);
dtp.iLeftMargin = 0;
dtp.iRightMargin = 0;
SetRect( &rect, 0, 0, 0, 0);
DrawTextExA(hdc, text, -1, &rect, DT_CALCRECT, &dtp);
textlen = rect.right; /* Width without margin */
dtp.iLeftMargin = 8;
SetRect( &rect, 0, 0, 0, 0);
DrawTextExA(hdc, text, -1, &rect, DT_CALCRECT, &dtp);
ok(rect.right==dtp.iLeftMargin+textlen ,"Incorrect left margin calculated rc(%d,%d)\n", rect.left, rect.right);
dtp.iLeftMargin = 0;
dtp.iRightMargin = 8;
SetRect( &rect, 0, 0, 0, 0);
DrawTextExA(hdc, text, -1, &rect, DT_CALCRECT, &dtp);
ok(rect.right==dtp.iRightMargin+textlen ,"Incorrect right margin calculated rc(%d,%d)\n", rect.left, rect.right);
/* Wide char versions */
SetRect( &rect, 10,10, 100, 100);
SetLastError( 0);
......
......@@ -900,8 +900,8 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
if (dtp)
{
lmargin = dtp->iLeftMargin * tm.tmAveCharWidth;
rmargin = dtp->iRightMargin * tm.tmAveCharWidth;
lmargin = dtp->iLeftMargin;
rmargin = dtp->iRightMargin;
if (!(flags & (DT_CENTER | DT_RIGHT)))
x += lmargin;
dtp->uiLengthDrawn = 0; /* This param RECEIVES number of chars processed */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment