Implement GdiGetCharDimensions

Huw D M Davies h.davies1 at physics.ox.ac.uk
Mon Jul 18 10:44:07 CDT 2005


On Mon, Jul 18, 2005 at 05:24:42PM +0200, Alexandre Julliard wrote:
> Huw D M Davies <h.davies1 at physics.ox.ac.uk> writes:
> 
> > Actually GetTextExtentPoint returns tm.tmHeight for cy, so there
> > shouldn't be any difference.
> 
> Ah right, in that case of course it makes no difference. But is that
> really the correct behavior for GetTextExtentPoint?

Yup.  Here's a test.

Huw Davies <huw at codeweavers.com>
Test to show that the height returned by GetTextExtentPoint is
the same as tmHeight.
-- 
Huw Davies
huw at codeweavers.com
Index: dlls/gdi/tests/gdiobj.c
===================================================================
RCS file: /home/wine/wine/dlls/gdi/tests/gdiobj.c,v
retrieving revision 1.6
diff -u -p -r1.6 gdiobj.c
--- dlls/gdi/tests/gdiobj.c	20 May 2005 18:58:19 -0000	1.6
+++ dlls/gdi/tests/gdiobj.c	18 Jul 2005 15:41:06 -0000
@@ -266,9 +266,34 @@ static void test_gdi_objects(void)
     ReleaseDC(NULL, hdc);
 }
 
+static void test_text_extents(void)
+{
+    LOGFONTA lf;
+    TEXTMETRICA tm;
+    HDC hdc;
+    HFONT hfont;
+    SIZE sz;
+
+    memset(&lf, 0, sizeof(lf));
+    strcpy(lf.lfFaceName, "Arial");
+    lf.lfHeight = 20;
+
+    hfont = CreateFontIndirectA(&lf);
+    hdc = GetDC(0);
+    hfont = SelectObject(hdc, hfont);
+    GetTextMetricsA(hdc, &tm);
+    GetTextExtentPointA(hdc, "o", 1, &sz);
+    ok(sz.cy == tm.tmHeight, "cy %ld tmHeight %ld\n", sz.cy, tm.tmHeight);
+
+    SelectObject(hdc, hfont);
+    DeleteObject(hfont);
+    ReleaseDC(NULL, hdc);
+}
+
 START_TEST(gdiobj)
 {
     test_logfont();
     test_bitmap_font();
     test_gdi_objects();
+    test_text_extents();
 }



More information about the wine-patches mailing list