From: Bartosz Kosiorek <gang65@poczta.onet.pl> We should shift X position only for StringAlignmentNear. --- dlls/gdiplus/graphics.c | 5 ++++- dlls/gdiplus/tests/graphics.c | 4 ---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 1d046e7d147..1d553e4b3e9 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -6016,7 +6016,10 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics, margin_x = stringFormat->generic_typographic ? 0.0 : font->emSize / 6.0; margin_x *= units_scale(font->unit, graphics->unit, graphics->xres, graphics->printer_display); transform_properties(graphics, NULL, TRUE, &args.rel_width, &args.rel_height, NULL); - scaled_rect.X = (layoutRect->X + margin_x) * args.rel_width; + if (stringFormat->align == StringAlignmentNear) + scaled_rect.X = (layoutRect->X + margin_x) * args.rel_width; + else + scaled_rect.X = layoutRect->X * args.rel_width; scaled_rect.Y = layoutRect->Y * args.rel_height; scaled_rect.Width = layoutRect->Width * args.rel_width; scaled_rect.Height = layoutRect->Height * args.rel_height; diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index 6ac85fe303c..c42a8087538 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -4948,7 +4948,6 @@ static void test_measure_string(void) set_rect_empty(&bounds); status = GdipGetRegionBounds(region, graphics, &bounds); expect(Ok, status); - todo_wine expectf_(5.0 + width_rgn/2.0, bounds.X, 1.0); todo_wine expectf_(5.0 + height_rgn/2.0, bounds.Y, 1.0); @@ -4964,7 +4963,6 @@ static void test_measure_string(void) set_rect_empty(&bounds); status = GdipGetRegionBounds(region, graphics, &bounds); expect(Ok, status); - todo_wine expectf_(5.0 - width_rgn/2.0, bounds.X, 1.0); todo_wine expectf_(5.0 - height_rgn/2.0, bounds.Y, 1.0); @@ -5012,7 +5010,6 @@ static void test_measure_string(void) set_rect_empty(&bounds); status = GdipGetRegionBounds(region, graphics, &bounds); expect(Ok, status); - todo_wine expectf_(5.0 + width_rgn, bounds.X, 2.0); todo_wine expectf_(5.0 + height_rgn, bounds.Y, 1.0); @@ -5028,7 +5025,6 @@ static void test_measure_string(void) set_rect_empty(&bounds); status = GdipGetRegionBounds(region, graphics, &bounds); expect(Ok, status); - todo_wine expectf_(5.0 - width_rgn, bounds.X, 2.0); todo_wine expectf_(5.0 - height_rgn, bounds.Y, 1.0); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10736