Lei Zhang : gdi32: Glyph advances should be measured for unrotated characters.

Alexandre Julliard julliard at winehq.org
Wed Jul 23 07:09:56 CDT 2008


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

Author: Lei Zhang <thestig at google.com>
Date:   Mon Jul 21 17:54:42 2008 -0700

gdi32: Glyph advances should be measured for unrotated characters.

---

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

diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 62db9fe..a2110ab 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -4300,6 +4300,7 @@ DWORD WineEngGetGlyphOutline(GdiFont *incoming_font, UINT glyph, UINT format,
     FT_Int load_flags = FT_LOAD_DEFAULT | FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH;
     double widthRatio = 1.0;
     FT_Matrix transMat = identityMat;
+    FT_Matrix transMatUnrotated;
     BOOL needsTransform = FALSE;
     BOOL tategaki = (font->GSUB_Table != NULL);
     UINT original_index;
@@ -4404,6 +4405,7 @@ DWORD WineEngGetGlyphOutline(GdiFont *incoming_font, UINT glyph, UINT format,
     }
 
     /* Rotation transform */
+    transMatUnrotated = transMat;
     if(font->orientation && !tategaki) {
         FT_Matrix rotationMat;
         FT_Vector vecAngle;
@@ -4427,6 +4429,7 @@ DWORD WineEngGetGlyphOutline(GdiFont *incoming_font, UINT glyph, UINT format,
         worldMat.yx = FT_FixedFromFloat(font->font_desc.matrix.eM12);
         worldMat.yy = FT_FixedFromFloat(font->font_desc.matrix.eM22);
         pFT_Matrix_Multiply(&worldMat, &transMat);
+        pFT_Matrix_Multiply(&worldMat, &transMatUnrotated);
         needsTransform = TRUE;
     }
 
@@ -4439,6 +4442,7 @@ DWORD WineEngGetGlyphOutline(GdiFont *incoming_font, UINT glyph, UINT format,
         extraMat.yx = FT_FixedFromFIXED(lpmat->eM12);
         extraMat.yy = FT_FixedFromFIXED(lpmat->eM22);
         pFT_Matrix_Multiply(&extraMat, &transMat);
+        pFT_Matrix_Multiply(&extraMat, &transMatUnrotated);
         needsTransform = TRUE;
     }
 
@@ -4479,8 +4483,13 @@ DWORD WineEngGetGlyphOutline(GdiFont *incoming_font, UINT glyph, UINT format,
 	vec.x = ft_face->glyph->metrics.horiAdvance;
 	vec.y = 0;
 	pFT_Vector_Transform(&vec, &transMat);
-	adv = lpgm->gmCellIncX = (vec.x+63) >> 6;
+	lpgm->gmCellIncX = (vec.x+63) >> 6;
 	lpgm->gmCellIncY = -((vec.y+63) >> 6);
+
+        vec.x = ft_face->glyph->metrics.horiAdvance;
+        vec.y = 0;
+        pFT_Vector_Transform(&vec, &transMatUnrotated);
+        adv = (vec.x+63) >> 6;
     }
     lpgm->gmBlackBoxX = (right - left) >> 6;
     lpgm->gmBlackBoxY = (top - bottom) >> 6;
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index e652bfe..9e8f408 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -2417,7 +2417,7 @@ static void test_orientation(void)
     hfont = create_font("orientation", &lf);
     old_hfont = SelectObject(hdc, hfont);
     ok(GetTextExtentExPointA(hdc, test_str, sizeof(test_str), 32767, NULL, NULL, &size), "GetTextExtentExPointA failed\n");
-    todo_wine ok(near_match(311, size.cx), "cx should be about 311, got %d\n", size.cx);
+    ok(near_match(311, size.cx), "cx should be about 311, got %d\n", size.cx);
     ok(near_match(75, size.cy), "cy should be about 75, got %d\n", size.cy);
     SelectObject(hdc, old_hfont);
     DeleteObject(hfont);




More information about the wine-cvs mailing list