From 967572051003a45ee8da5dabb5ab18809bc6e989 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Tue, 24 Jun 2008 16:10:47 +0900 Subject: [PATCH] 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 57164bd8fcc..1fc385ddd27 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 3ae512c33bc..0cffbfb64f6 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);