gdi32: Fix handling of font orientation in advanced graphics mode.

This commit is contained in:
Alexandre Julliard 2012-12-10 14:33:53 +01:00
parent 75fff47f94
commit b057c5f140
5 changed files with 33 additions and 20 deletions

View file

@ -1051,6 +1051,8 @@ INT WINAPI SetGraphicsMode( HDC hdc, INT mode )
dc->GraphicsMode = mode;
}
release_dc_ptr( dc );
/* font metrics depend on the graphics mode */
if (ret) SelectObject(dc->hSelf, GetCurrentObject(dc->hSelf, OBJ_FONT));
return ret;
}

View file

@ -499,8 +499,12 @@ static struct cached_font *add_cached_font( HDC hdc, HFONT hfont, UINT aa_flags
GetObjectW( hfont, sizeof(font.lf), &font.lf );
GetTransform( hdc, 0x204, &font.xform );
font.xform.eDx = font.xform.eDy = 0; /* unused, would break hashing */
if (GetGraphicsMode( hdc ) == GM_COMPATIBLE && font.xform.eM11 * font.xform.eM22 < 0)
font.lf.lfOrientation = -font.lf.lfOrientation;
if (GetGraphicsMode( hdc ) == GM_COMPATIBLE)
{
font.lf.lfOrientation = font.lf.lfEscapement;
if (font.xform.eM11 * font.xform.eM22 < 0)
font.lf.lfOrientation = -font.lf.lfOrientation;
}
font.lf.lfWidth = abs( font.lf.lfWidth );
font.aa_flags = aa_flags;
font.hash = font_cache_hash( &font );

View file

@ -395,15 +395,6 @@ HFONT WINAPI CreateFontIndirectExW( const ENUMLOGFONTEXDVW *penumex )
fontPtr->logfont = *plf;
if (plf->lfEscapement != plf->lfOrientation)
{
/* this should really depend on whether GM_ADVANCED is set */
fontPtr->logfont.lfOrientation = fontPtr->logfont.lfEscapement;
WARN("orientation angle %f set to "
"escapement angle %f for new font %p\n",
plf->lfOrientation/10., plf->lfEscapement/10., fontPtr);
}
if (!(hFont = alloc_gdi_handle( fontPtr, OBJ_FONT, &font_funcs )))
{
HeapFree( GetProcessHeap(), 0, fontPtr );
@ -2274,10 +2265,6 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
if (dc->vport2WorldValid && dc->xformWorld2Vport.eM22 < 0)
desired[1].y = -desired[1].y;
}
else
{
if (layout & LAYOUT_RTL) desired[1].x = -desired[1].x;
}
deltas[i].x = desired[1].x - width.x;
deltas[i].y = desired[1].y - width.y;
@ -2288,6 +2275,8 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
}
else
{
POINT desired[2];
if(!done_extents)
{
if(flags & ETO_GLYPH_INDEX)
@ -2296,8 +2285,21 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
GetTextExtentPointW(hdc, reordered_str, count, &sz);
done_extents = TRUE;
}
width.x = abs(INTERNAL_XWSTODS(dc, sz.cx));
width.y = 0;
desired[0].x = desired[0].y = 0;
desired[1].x = sz.cx;
desired[1].y = 0;
LPtoDP(hdc, desired, 2);
desired[1].x -= desired[0].x;
desired[1].y -= desired[0].y;
if (dc->GraphicsMode == GM_COMPATIBLE)
{
if (dc->vport2WorldValid && dc->xformWorld2Vport.eM11 < 0)
desired[1].x = -desired[1].x;
if (dc->vport2WorldValid && dc->xformWorld2Vport.eM22 < 0)
desired[1].y = -desired[1].y;
}
width = desired[1];
}
tm.tmAscent = abs(INTERNAL_YWSTODS(dc, tm.tmAscent));

View file

@ -4578,7 +4578,7 @@ static HFONT freetype_SelectFont( PHYSDEV dev, HFONT hfont, UINT *aa_flags )
{
lf.lfHeight *= fabs(dcmat.eM11);
lf.lfWidth *= fabs(dcmat.eM11);
dcmat.eM11 = dcmat.eM22 = 1.0;
dcmat.eM11 = dcmat.eM22 = dcmat.eM11 < 0 ? -1 : 1;
}
}
else
@ -4587,6 +4587,7 @@ static HFONT freetype_SelectFont( PHYSDEV dev, HFONT hfont, UINT *aa_flags )
font scaling abilities. */
dcmat.eM11 = dcmat.eM22 = 1.0;
dcmat.eM21 = dcmat.eM12 = 0;
lf.lfOrientation = lf.lfEscapement;
if (dc->vport2WorldValid)
{
if (dc->xformWorld2Vport.eM11 * dc->xformWorld2Vport.eM22 < 0)

View file

@ -884,8 +884,12 @@ static HFONT xrenderdrv_SelectFont( PHYSDEV dev, HFONT hfont, UINT *aa_flags )
TRACE("font transform %f %f %f %f\n", lfsz.xform.eM11, lfsz.xform.eM12,
lfsz.xform.eM21, lfsz.xform.eM22);
if (GetGraphicsMode( dev->hdc ) == GM_COMPATIBLE && lfsz.xform.eM11 * lfsz.xform.eM22 < 0)
lfsz.lf.lfOrientation = -lfsz.lf.lfOrientation;
if (GetGraphicsMode( dev->hdc ) == GM_COMPATIBLE)
{
lfsz.lf.lfOrientation = lfsz.lf.lfEscapement;
if (lfsz.xform.eM11 * lfsz.xform.eM22 < 0)
lfsz.lf.lfOrientation = -lfsz.lf.lfOrientation;
}
/* Not used fields, would break hashing */
lfsz.xform.eDx = lfsz.xform.eDy = 0;