gdiplus: GdipGetLogFontW should transform returned font height using font and device unit/resolution/scale.

This commit is contained in:
Dmitry Timoshkov 2012-08-09 12:54:48 +09:00 committed by Alexandre Julliard
parent e9af648aeb
commit f8b1154226
2 changed files with 17 additions and 14 deletions

View File

@ -449,8 +449,23 @@ GpStatus WINGDIPAPI GdipGetLogFontA(GpFont *font, GpGraphics *graphics,
void get_log_fontW(const GpFont *font, GpGraphics *graphics, LOGFONTW *lf) void get_log_fontW(const GpFont *font, GpGraphics *graphics, LOGFONTW *lf)
{ {
/* FIXME: use graphics */ REAL height;
lf->lfHeight = -units_to_pixels(font->emSize, font->unit, font->family->dpi);
if (font->unit == UnitPixel)
{
height = units_to_pixels(font->emSize, graphics->unit, graphics->yres);
if (graphics->unit != UnitDisplay)
height *= graphics->scale;
}
else
{
if (graphics->unit == UnitDisplay || graphics->unit == UnitPixel)
height = units_to_pixels(font->emSize, font->unit, graphics->xres);
else
height = units_to_pixels(font->emSize, font->unit, graphics->yres);
}
lf->lfHeight = -(height + 0.5);
lf->lfWidth = 0; lf->lfWidth = 0;
lf->lfEscapement = 0; lf->lfEscapement = 0;
lf->lfOrientation = 0; lf->lfOrientation = 0;

View File

@ -3479,19 +3479,8 @@ static void test_GdipMeasureString(void)
height = units_to_pixels(font_size, td[i].unit, td[i].res_y); height = units_to_pixels(font_size, td[i].unit, td[i].res_y);
if (td[i].unit != UnitDisplay) if (td[i].unit != UnitDisplay)
height *= td[i].page_scale; height *= td[i].page_scale;
/* FIXME: remove once Wine is fixed */
if (td[i].unit == UnitDisplay || (td[i].unit == UnitPixel && td[i].page_scale == 1.0))
ok(-lf.lfHeight == (LONG)(height + 0.5), "%u: expected %d (%f), got %d\n", ok(-lf.lfHeight == (LONG)(height + 0.5), "%u: expected %d (%f), got %d\n",
i, (LONG)(height + 0.5), height, lf.lfHeight); i, (LONG)(height + 0.5), height, lf.lfHeight);
else
{
todo_wine
ok(-lf.lfHeight == (LONG)(height + 0.5), "%u: expected %d (%f), got %d\n",
i, (LONG)(height + 0.5), height, lf.lfHeight);
/* further testing is useless */
GdipDeleteGraphics(graphics);
continue;
}
height = font_size * font_to_pixel_scale; height = font_size * font_to_pixel_scale;
@ -3572,7 +3561,6 @@ static void test_GdipMeasureString(void)
else else
height = units_to_pixels(font_size, font_unit, td[i].res_y); height = units_to_pixels(font_size, font_unit, td[i].res_y);
/*trace("%.1f font units = %f pixels with %.1f dpi, page_scale %.1f\n", font_size, height, td[i].res_y, td[i].page_scale);*/ /*trace("%.1f font units = %f pixels with %.1f dpi, page_scale %.1f\n", font_size, height, td[i].res_y, td[i].page_scale);*/
todo_wine
ok(-lf.lfHeight == (LONG)(height + 0.5), "%u: expected %d (%f), got %d\n", ok(-lf.lfHeight == (LONG)(height + 0.5), "%u: expected %d (%f), got %d\n",
i, (LONG)(height + 0.5), height, lf.lfHeight); i, (LONG)(height + 0.5), height, lf.lfHeight);