Commit f8b11542 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

gdiplus: GdipGetLogFontW should transform returned font height using font and…

gdiplus: GdipGetLogFontW should transform returned font height using font and device unit/resolution/scale.
parent e9af648a
......@@ -449,8 +449,23 @@ GpStatus WINGDIPAPI GdipGetLogFontA(GpFont *font, GpGraphics *graphics,
void get_log_fontW(const GpFont *font, GpGraphics *graphics, LOGFONTW *lf)
{
/* FIXME: use graphics */
lf->lfHeight = -units_to_pixels(font->emSize, font->unit, font->family->dpi);
REAL height;
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->lfEscapement = 0;
lf->lfOrientation = 0;
......
......@@ -3479,19 +3479,8 @@ static void test_GdipMeasureString(void)
height = units_to_pixels(font_size, td[i].unit, td[i].res_y);
if (td[i].unit != UnitDisplay)
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",
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;
......@@ -3572,7 +3561,6 @@ static void test_GdipMeasureString(void)
else
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);*/
todo_wine
ok(-lf.lfHeight == (LONG)(height + 0.5), "%u: expected %d (%f), got %d\n",
i, (LONG)(height + 0.5), height, lf.lfHeight);
......
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