Dmitry Timoshkov : gdi32: Initialize otmMacAscent, otmMacDescent, otmMacLineGap in outline text metrics.

Alexandre Julliard julliard at winehq.org
Tue Jun 24 06:46:31 CDT 2008


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

Author: Dmitry Timoshkov <dmitry at codeweavers.com>
Date:   Tue Jun 24 16:10:47 2008 +0900

gdi32: Initialize otmMacAscent, otmMacDescent, otmMacLineGap in outline text metrics.

---

 dlls/gdi32/freetype.c   |    8 ++++----
 dlls/gdi32/tests/font.c |    5 +++--
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 57164bd..1fc385d 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -5103,7 +5103,6 @@ UINT WineEngGetOutlineTextMetrics(GdiFont *font, UINT cbSize,
     }
 
     TM.tmCharSet = font->charset;
-#undef TM
 
     font->potm->otmFiller = 0;
     memcpy(&font->potm->otmPanoseNumber, pOS2->panose, PANOSE_COUNT);
@@ -5122,9 +5121,9 @@ UINT WineEngGetOutlineTextMetrics(GdiFont *font, UINT cbSize,
     font->potm->otmrcFontBox.right = (pFT_MulFix(ft_face->bbox.xMax, x_scale) + 32) >> 6;
     font->potm->otmrcFontBox.top = (pFT_MulFix(ft_face->bbox.yMax, y_scale) + 32) >> 6;
     font->potm->otmrcFontBox.bottom = (pFT_MulFix(ft_face->bbox.yMin, y_scale) + 32) >> 6;
-    font->potm->otmMacAscent = 0; /* where do these come from ? */
-    font->potm->otmMacDescent = 0;
-    font->potm->otmMacLineGap = 0;
+    font->potm->otmMacAscent = TM.tmAscent;
+    font->potm->otmMacDescent = -TM.tmDescent;
+    font->potm->otmMacLineGap = font->potm->otmLineGap;
     font->potm->otmusMinimumPPEM = 0; /* TT Header */
     font->potm->otmptSubscriptSize.x = (pFT_MulFix(pOS2->ySubscriptXSize, x_scale) + 32) >> 6;
     font->potm->otmptSubscriptSize.y = (pFT_MulFix(pOS2->ySubscriptYSize, y_scale) + 32) >> 6;
@@ -5143,6 +5142,7 @@ UINT WineEngGetOutlineTextMetrics(GdiFont *font, UINT cbSize,
         font->potm->otmsUnderscoreSize = (pFT_MulFix(pPost->underlineThickness, y_scale) + 32) >> 6;
 	font->potm->otmsUnderscorePosition = (pFT_MulFix(pPost->underlinePosition, y_scale) + 32) >> 6;
     }
+#undef TM
 
     /* otmp* members should clearly have type ptrdiff_t, but M$ knows best */
     cp = (char*)font->potm + sizeof(*font->potm);
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index 3ae512c..0cffbfb 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -30,6 +30,7 @@
 
 #include "wine/test.h"
 
+#define near_match(a, b) (abs((a) - (b)) <= 4)
 #define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
 
 LONG  (WINAPI *pGdiGetCharDimensions)(HDC hdc, LPTEXTMETRICW lptm, LONG *height);
@@ -781,6 +782,8 @@ static void test_GetKerningPairs(void)
            kd[i].otmDescent, otm.otmDescent);
         ok(kd[i].otmLineGap == otm.otmLineGap, "expected %u, got %u\n",
            kd[i].otmLineGap, otm.otmLineGap);
+        ok(near_match(kd[i].otmMacDescent, otm.otmMacDescent), "expected %d, got %d\n",
+           kd[i].otmMacDescent, otm.otmMacDescent);
 todo_wine {
         ok(kd[i].otmsCapEmHeight == otm.otmsCapEmHeight, "expected %u, got %u\n",
            kd[i].otmsCapEmHeight, otm.otmsCapEmHeight);
@@ -788,8 +791,6 @@ todo_wine {
            kd[i].otmsXHeight, otm.otmsXHeight);
         ok(kd[i].otmMacAscent == otm.otmMacAscent, "expected %d, got %d\n",
            kd[i].otmMacAscent, otm.otmMacAscent);
-        ok(kd[i].otmMacDescent == otm.otmMacDescent, "expected %d, got %d\n",
-           kd[i].otmMacDescent, otm.otmMacDescent);
         /* FIXME: this one sometimes succeeds due to expected 0, enable it when removing todo */
         if (0) ok(kd[i].otmMacLineGap == otm.otmMacLineGap, "expected %u, got %u\n",
            kd[i].otmMacLineGap, otm.otmMacLineGap);




More information about the wine-cvs mailing list