Akihiro Sagawa : gdi32: Fix ABC metrics for rotated font.

Alexandre Julliard julliard at winehq.org
Mon Jan 13 12:46:33 CST 2014


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

Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date:   Fri Jan 10 20:29:58 2014 +0900

gdi32: Fix ABC metrics for rotated font.

---

 dlls/gdi32/freetype.c   |   18 ++++++++++++++++--
 dlls/gdi32/tests/font.c |    2 --
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index f8b365b..3cc8dd8 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -6438,6 +6438,8 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format,
 	gm.gmCellIncY = 0;
         origin_x = left;
         origin_y = top;
+        abc->abcA = origin_x >> 6;
+        abc->abcB = metrics.width >> 6;
     } else {
         INT xc, yc;
 	FT_Vector vec;
@@ -6534,6 +6536,19 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format,
             pFT_Vector_Transform(&vec, &transMatUnrotated);
             adv = pFT_MulFix(vec.x, em_scale) * 2;
         }
+
+        vec.x = metrics.horiBearingX;
+        vec.y = 0;
+        pFT_Vector_Transform(&vec, &transMatUnrotated);
+        abc->abcA = vec.x >> 6;
+
+        vec.x = metrics.width;
+        vec.y = 0;
+        pFT_Vector_Transform(&vec, &transMatUnrotated);
+        if (vec.x >= 0)
+            abc->abcB = vec.x >> 6;
+        else
+            abc->abcB = -vec.x >> 6;
     }
 
     width  = (right - left) >> 6;
@@ -6542,8 +6557,7 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format,
     gm.gmBlackBoxY = height ? height : 1;
     gm.gmptGlyphOrigin.x = origin_x >> 6;
     gm.gmptGlyphOrigin.y = origin_y >> 6;
-    abc->abcA = left >> 6;
-    abc->abcB = gm.gmBlackBoxX;
+    if (!abc->abcB) abc->abcB = 1;
     abc->abcC = adv - abc->abcA - abc->abcB;
 
     TRACE("%u,%u,%s,%d,%d\n", gm.gmBlackBoxX, gm.gmBlackBoxY,
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index 28bec52..e05cfea 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -1325,14 +1325,12 @@ static void test_GetCharABCWidths(void)
     ok(ret, "GetCharABCWidthsW should have succeeded\n");
 
     /* 3) compare ABC results */
-    todo_wine {
     ok(match_off_by_1(abcw[0].abcA, abc[0].abcA, FALSE),
        "got %d, expected %d (A)\n", abc[0].abcA, abcw[0].abcA);
     ok(match_off_by_1(abcw[0].abcB, abc[0].abcB, FALSE),
        "got %d, expected %d (B)\n", abc[0].abcB, abcw[0].abcB);
     ok(match_off_by_1(abcw[0].abcC, abc[0].abcC, FALSE),
        "got %d, expected %d (C)\n", abc[0].abcC, abcw[0].abcC);
-    }
 
     DeleteObject(SelectObject(hdc, hfont));
     ReleaseDC(NULL, hdc);




More information about the wine-cvs mailing list