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

gdiplus: Measure the passed in string without height clipping in order to compute correct Y offset.

parent c4368874
...@@ -5161,14 +5161,18 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string ...@@ -5161,14 +5161,18 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string
/* Should be no need to explicitly test for StringAlignmentNear as /* Should be no need to explicitly test for StringAlignmentNear as
* that is default behavior if no alignment is passed. */ * that is default behavior if no alignment is passed. */
if(format->vertalign != StringAlignmentNear){ if(format->vertalign != StringAlignmentNear){
RectF bounds; RectF bounds, in_rect = *rect;
GdipMeasureString(graphics, string, length, font, rect, format, &bounds, 0, 0); in_rect.Height = 0.0; /* avoid height clipping */
GdipMeasureString(graphics, string, length, font, &in_rect, format, &bounds, 0, 0);
TRACE("bounds %s\n", debugstr_rectf(&bounds));
if(format->vertalign == StringAlignmentCenter) if(format->vertalign == StringAlignmentCenter)
offsety = (rect->Height - bounds.Height) / 2; offsety = (rect->Height - bounds.Height) / 2;
else if(format->vertalign == StringAlignmentFar) else if(format->vertalign == StringAlignmentFar)
offsety = (rect->Height - bounds.Height); offsety = (rect->Height - bounds.Height);
} }
TRACE("vertical align %d, offsety %f\n", format->vertalign, offsety);
} }
save_state = SaveDC(hdc); save_state = SaveDC(hdc);
......
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