Dmitry Timoshkov : gdiplus: get_font_hfont() should ask gdi32 to match font height against the character height instead of cell height .

Alexandre Julliard julliard at winehq.org
Wed Jun 19 13:41:30 CDT 2013


Module: wine
Branch: master
Commit: 84ef3d484ca52bd403e18248d98bd9343424fb9a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=84ef3d484ca52bd403e18248d98bd9343424fb9a

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Wed Jun 19 17:23:27 2013 +0900

gdiplus: get_font_hfont() should ask gdi32 to match font height against the character height instead of cell height.

---

 dlls/gdiplus/graphics.c       |    2 +-
 dlls/gdiplus/tests/font.c     |   43 ++++++++++++----------------------------
 dlls/gdiplus/tests/graphics.c |    1 -
 3 files changed, 14 insertions(+), 32 deletions(-)

diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 10a6402..dcdc29e 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -2099,7 +2099,7 @@ static void get_font_hfont(GpGraphics *graphics, GDIPCONST GpFont *font,
                       (pt[2].X-pt[0].X)*(pt[2].X-pt[0].X));
 
     get_log_fontW(font, graphics, &lfw);
-    lfw.lfHeight = gdip_round(font_height * rel_height);
+    lfw.lfHeight = -gdip_round(font_height * rel_height);
     unscaled_font = CreateFontIndirectW(&lfw);
 
     SelectObject(hdc, unscaled_font);
diff --git a/dlls/gdiplus/tests/font.c b/dlls/gdiplus/tests/font.c
index de6d657..29d4ad5 100644
--- a/dlls/gdiplus/tests/font.c
+++ b/dlls/gdiplus/tests/font.c
@@ -877,26 +877,21 @@ todo_wine
     expect(Ok, status);
     expectf(0.0, bounds.X);
     expectf(0.0, bounds.Y);
-todo_wine
-    expectf(height, bounds.Height);
+    expectf_(height, bounds.Height, 1.0);
     set_rect_empty(&bounds);
     status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
                                      DriverStringOptionsCmapLookup, NULL, &bounds);
     expect(Ok, status);
     expectf(0.0, bounds.X);
-todo_wine
     expectf_(-100.0, bounds.Y, 0.05);
-todo_wine
-    expectf(height, bounds.Height);
+    expectf_(height, bounds.Height, 0.5);
     set_rect_empty(&bounds);
     status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
                                      DriverStringOptionsCmapLookup, matrix, &bounds);
     expect(Ok, status);
     expectf(0.0, bounds.X);
-todo_wine
     expectf_(-100.0, bounds.Y, 0.05);
-todo_wine
-    expectf(height, bounds.Height);
+    expectf_(height, bounds.Height, 0.5);
 
     /* scale matrix */
     status = GdipScaleMatrix(matrix, 2.0, 3.0, MatrixOrderAppend);
@@ -926,17 +921,14 @@ todo_wine
     expect(Ok, status);
     expectf(0.0, bounds.X);
     expectf(0.0, bounds.Y);
-todo_wine
-    expectf(height, bounds.Height);
+    expectf_(height, bounds.Height, 0.05);
     set_rect_empty(&bounds);
     status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
                                      DriverStringOptionsCmapLookup, NULL, &bounds);
     expect(Ok, status);
     expectf(0.0, bounds.X);
-todo_wine
     expectf_(-100.0, bounds.Y, 0.05);
-todo_wine
-    expectf(height, bounds.Height);
+    expectf_(height, bounds.Height, 0.2);
     set_rect_empty(&bounds);
     status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
                                      DriverStringOptionsCmapLookup, matrix, &bounds);
@@ -975,17 +967,14 @@ todo_wine
     expect(Ok, status);
     expectf(0.0, bounds.X);
     expectf(0.0, bounds.Y);
-todo_wine
-    expectf(height, bounds.Height);
+    expectf_(height, bounds.Height, 0.05);
     set_rect_empty(&bounds);
     status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
                                      DriverStringOptionsCmapLookup, NULL, &bounds);
     expect(Ok, status);
     expectf(0.0, bounds.X);
-todo_wine
     expectf_(-100.0, bounds.Y, 0.05);
-todo_wine
-    expectf(height, bounds.Height);
+    expectf_(height, bounds.Height, 0.2);
     set_rect_empty(&bounds);
     status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
                                      DriverStringOptionsCmapLookup, matrix, &bounds);
@@ -1026,17 +1015,14 @@ todo_wine
     expect(Ok, status);
     expectf(0.0, bounds.X);
     expectf(0.0, bounds.Y);
-todo_wine
-    expectf(height, bounds.Height);
+    expectf_(height, bounds.Height, 0.2);
     set_rect_empty(&bounds);
     status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
                                      DriverStringOptionsCmapLookup, NULL, &bounds);
     expect(Ok, status);
     expectf(0.0, bounds.X);
-todo_wine
-    expectf_(-100.0, bounds.Y, 0.05);
-todo_wine
-    expectf(height, bounds.Height);
+    expectf_(-100.0, bounds.Y, 0.2);
+    expectf_(height, bounds.Height, 0.2);
     set_rect_empty(&bounds);
     status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
                                      DriverStringOptionsCmapLookup, matrix, &bounds);
@@ -1077,17 +1063,14 @@ todo_wine
     expect(Ok, status);
     expectf(0.0, bounds.X);
     expectf(0.0, bounds.Y);
-todo_wine
-    expectf(height, bounds.Height);
+    expectf_(height, bounds.Height, 0.1);
     set_rect_empty(&bounds);
     status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
                                      DriverStringOptionsCmapLookup, NULL, &bounds);
     expect(Ok, status);
     expectf(0.0, bounds.X);
-todo_wine
-    expectf_(-100.0, bounds.Y, 0.05);
-todo_wine
-    expectf(height, bounds.Height);
+    expectf_(-100.0, bounds.Y, 0.2);
+    expectf_(height, bounds.Height, 0.2);
     set_rect_empty(&bounds);
     status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
                                      DriverStringOptionsCmapLookup, matrix, &bounds);
diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c
index 5de0602..6ed1463 100644
--- a/dlls/gdiplus/tests/graphics.c
+++ b/dlls/gdiplus/tests/graphics.c
@@ -3901,7 +3901,6 @@ todo_wine
             match = fabs(1.0 - margin / rect.X) <= 0.05;
             ok(match, "Expected %f, got %f\n", margin, rect.X);
             match = fabs(1.0 - font_height / rect.Height) <= 0.1;
-todo_wine
             ok(match, "Expected %f, got %f\n", font_height, rect.Height);
             match = fabs(1.0 - bounds.Width / (rect.Width + margin * 2.0)) <= 0.05;
             ok(match, "Expected %f, got %f\n", bounds.Width, rect.Width + margin * 2.0);




More information about the wine-cvs mailing list