Dmitry Timoshkov : gdiplus: Make GdipMeasureCharacterRanges use common font transformation code.

Alexandre Julliard julliard at winehq.org
Fri Aug 24 13:46:44 CDT 2012


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

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Fri Aug 24 15:43:45 2012 +0900

gdiplus: Make GdipMeasureCharacterRanges use common font transformation code.

---

 dlls/gdiplus/graphics.c       |   10 +++++-----
 dlls/gdiplus/tests/graphics.c |    6 +++++-
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 0056a2f..a0c130e 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -4927,8 +4927,7 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics,
 {
     GpStatus stat;
     int i;
-    LOGFONTW lfw;
-    HFONT oldfont;
+    HFONT gdifont, oldfont;
     struct measure_ranges_args args;
     HDC hdc, temp_hdc=NULL;
     GpPointF pt[3];
@@ -4971,8 +4970,8 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics,
     scaled_rect.Width = layoutRect->Width * args.rel_width;
     scaled_rect.Height = layoutRect->Height * args.rel_height;
 
-    get_log_fontW(font, graphics, &lfw);
-    oldfont = SelectObject(hdc, CreateFontIndirectW(&lfw));
+    get_font_hfont(graphics, font, &gdifont);
+    oldfont = SelectObject(hdc, gdifont);
 
     for (i=0; i<stringFormat->range_count; i++)
     {
@@ -4986,7 +4985,8 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics,
     stat = gdip_format_string(hdc, string, length, font, &scaled_rect, stringFormat,
         measure_ranges_callback, &args);
 
-    DeleteObject(SelectObject(hdc, oldfont));
+    SelectObject(hdc, oldfont);
+    DeleteObject(gdifont);
 
     if (temp_hdc)
         DeleteDC(temp_hdc);
diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c
index 913d895..1cd847d 100644
--- a/dlls/gdiplus/tests/graphics.c
+++ b/dlls/gdiplus/tests/graphics.c
@@ -3828,9 +3828,13 @@ static void test_font_height_scaling(void)
                 win_skip("GdipMeasureCharacterRanges ignores units before Win7\n");
                 continue;
             }
+            /* FIXME: Wine uses integer gdi32 regions and rounding breaks things */
+            if (height < 1.0)
             expectf_(height, rect.Height, height / 15.0);
+            else
 todo_wine
-            expectf_(bounds.Width, rect.Width + margin * 2.0, bounds.Width / 25.0);
+            expectf_(height, rect.Height, height / 15.0);
+            expectf_(bounds.Width, rect.Width + margin * 2.0, bounds.Width / 15.0);
         }
     }
 




More information about the wine-cvs mailing list