Fix for rotated text when lpDx is specified.

Better handling of cumulative rounding errors.
This commit is contained in:
Huw D M Davies 2001-02-12 01:21:34 +00:00 committed by Alexandre Julliard
parent e527f23865
commit a83c7c5320
1 changed files with 9 additions and 7 deletions

View File

@ -161,15 +161,17 @@ static BOOL PSDRV_Text(DC *dc, INT x, INT y, LPCWSTR str, UINT count,
if(!lpDx)
PSDRV_WriteShow(dc, strbuf, lstrlenW(strbuf));
else {
INT i, dx, dy;
INT newx = x, newy = y;
INT i;
float dx = 0.0, dy = 0.0;
float cos_theta = cos(physDev->font.escapement * M_PI / 1800.0);
float sin_theta = sin(physDev->font.escapement * M_PI / 1800.0);
for(i = 0; i < count-1; i++) {
TRACE("lpDx[%d] = %d\n", i, lpDx[i]);
PSDRV_WriteShow(dc, &strbuf[i], 1);
dx = lpDx[i] * cos(physDev->font.escapement);
dy = lpDx[i] * sin(physDev->font.escapement);
newx += INTERNAL_XWSTODS(dc, dx);
newy += INTERNAL_YWSTODS(dc, dy);
PSDRV_WriteMoveTo(dc, newx, newy);
dx += lpDx[i] * cos_theta;
dy -= lpDx[i] * sin_theta;
PSDRV_WriteMoveTo(dc, x + INTERNAL_XWSTODS(dc, dx),
y + INTERNAL_YWSTODS(dc, dy));
}
PSDRV_WriteShow(dc, &strbuf[i], 1);
}