Huw Davies : gdi32: Add a partial implementation of GdiRealizationInfo.

Alexandre Julliard julliard at winehq.org
Thu Feb 28 06:21:18 CST 2008


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

Author: Huw Davies <huw at codeweavers.com>
Date:   Wed Feb 27 17:00:06 2008 +0000

gdi32: Add a partial implementation of GdiRealizationInfo.

---

 dlls/gdi32/font.c       |   31 +++++++++++++++++++++++++++-
 dlls/gdi32/gdi32.spec   |    2 +-
 dlls/gdi32/tests/font.c |   50 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 80 insertions(+), 3 deletions(-)

diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 2d02b34..7f29936 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -348,7 +348,7 @@ HFONT WINAPI CreateFontIndirectW( const LOGFONTW *plf )
     if (!(fontPtr = GDI_AllocObject( sizeof(FONTOBJ), FONT_MAGIC, (HGDIOBJ *)&hFont,
                                      &font_funcs ))) return 0;
 
-    memcpy( &fontPtr->logfont, plf, sizeof(LOGFONTW) );
+    fontPtr->logfont = *plf;
 
     TRACE("(%d %d %d %d %x %d %x %d %d) %s %s %s %s => %p\n",
           plf->lfHeight, plf->lfWidth,
@@ -2536,7 +2536,7 @@ BOOL WINAPI TranslateCharsetInfo(
       return FALSE;
     }
     if (index >= MAXTCIINDEX || FONT_tci[index].ciCharset == DEFAULT_CHARSET) return FALSE;
-    memcpy(lpCs, &FONT_tci[index], sizeof(CHARSETINFO));
+    *lpCs = FONT_tci[index];
     return TRUE;
 }
 
@@ -3209,3 +3209,30 @@ BOOL WINAPI FontIsLinked(HDC hdc)
     TRACE("returning %d\n", ret);
     return ret;
 }
+
+/*************************************************************
+ *           GdiRealizationInfo    (GDI32.@)
+ *
+ * Returns a structure that contains some font information.
+ */
+typedef struct
+{
+    DWORD flags;       /* 1 for bitmap fonts, 3 for scalable fonts */
+    DWORD unknown1;    /* keeps incrementing - num of fonts that have been created or selected into a dc ?? */
+    DWORD unknown2;    /* fixed for a given font - looks like it could be the order of the face in the font list or the order
+                          in which the face was first rendered. */
+} realization_info_t;
+
+BOOL WINAPI GdiRealizationInfo(HDC hdc, realization_info_t *info)
+{
+    UINT otm_size;
+    FIXME("(%p, %p): stub!\n", hdc, info);
+
+    info->flags = 1;
+    otm_size = GetOutlineTextMetricsW(hdc, 0, NULL);
+    if(otm_size) info->flags |= 2;  /* scalable */
+
+    info->unknown1 = -1;
+    info->unknown2 = -1;
+    return TRUE;
+}
diff --git a/dlls/gdi32/gdi32.spec b/dlls/gdi32/gdi32.spec
index 4738a38..99df6d1 100644
--- a/dlls/gdi32/gdi32.spec
+++ b/dlls/gdi32/gdi32.spec
@@ -206,7 +206,7 @@
 # @ stub GdiProcessSetup
 # @ stub GdiQueryFonts
 # @ stub GdiQueryTable
-# @ stub GdiRealizationInfo
+@ stdcall GdiRealizationInfo(long ptr)
 # @ stub GdiReleaseDC
 @ stub GdiReleaseLocalDC
 # @ stub GdiResetDCEMF
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index 7e560d2..ebc3daf 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -38,6 +38,7 @@ BOOL  (WINAPI *pGetCharABCWidthsW)(HDC hdc, UINT first, UINT last, LPABC abc);
 DWORD (WINAPI *pGetFontUnicodeRanges)(HDC hdc, LPGLYPHSET lpgs);
 DWORD (WINAPI *pGetGlyphIndicesA)(HDC hdc, LPCSTR lpstr, INT count, LPWORD pgi, DWORD flags);
 DWORD (WINAPI *pGetGlyphIndicesW)(HDC hdc, LPCWSTR lpstr, INT count, LPWORD pgi, DWORD flags);
+BOOL  (WINAPI *pGdiRealizationInfo)(HDC hdc, DWORD *);
 
 static HMODULE hgdi32 = 0;
 
@@ -51,6 +52,7 @@ static void init(void)
     pGetFontUnicodeRanges = (void *)GetProcAddress(hgdi32, "GetFontUnicodeRanges");
     pGetGlyphIndicesA = (void *)GetProcAddress(hgdi32, "GetGlyphIndicesA");
     pGetGlyphIndicesW = (void *)GetProcAddress(hgdi32, "GetGlyphIndicesW");
+    pGdiRealizationInfo = (void *)GetProcAddress(hgdi32, "GdiRealizationInfo");
 }
 
 static INT CALLBACK is_truetype_font_installed_proc(const LOGFONT *elf, const TEXTMETRIC *ntm, DWORD type, LPARAM lParam)
@@ -1745,6 +1747,53 @@ static void test_nonexistent_font(void)
     ReleaseDC(0, hdc);
 }
 
+static void test_GdiRealizationInfo(void)
+{
+    HDC hdc;
+    DWORD info[4];
+    BOOL r;
+    HFONT hfont, hfont_old;
+    LOGFONTA lf;
+
+    if(!pGdiRealizationInfo)
+    {
+        skip("GdiRealizationInfo not available\n");
+        return;
+    }
+
+    hdc = GetDC(0);
+
+    memset(info, 0xcc, sizeof(info));
+    r = pGdiRealizationInfo(hdc, info);
+    ok(r != 0, "ret 0\n");
+    ok(info[0] == 1, "info[0] = %x for the system font\n", info[0]);
+    ok(info[3] == 0xcccccccc, "structure longer than 3 dwords");
+
+    if (!is_truetype_font_installed("Arial"))
+    {
+        skip("skipping GdiRealizationInfo with truetype font\n");
+        goto end;
+    }
+
+    memset(&lf, 0, sizeof(lf));
+    strcpy(lf.lfFaceName, "Arial");
+    lf.lfHeight = 20;
+    lf.lfWeight = FW_NORMAL;
+    hfont = CreateFontIndirectA(&lf);
+    hfont_old = SelectObject(hdc, hfont);
+
+    memset(info, 0xcc, sizeof(info));
+    r = pGdiRealizationInfo(hdc, info);
+    ok(r != 0, "ret 0\n");
+    ok(info[0] == 3, "info[0] = %x for arial\n", info[0]);
+    ok(info[3] == 0xcccccccc, "structure longer than 3 dwords");
+
+    DeleteObject(SelectObject(hdc, hfont_old));
+
+ end:
+    ReleaseDC(0, hdc);
+}
+
 START_TEST(font)
 {
     init();
@@ -1778,4 +1827,5 @@ START_TEST(font)
     else
         skip("Arial Black or Symbol/Wingdings is not installed\n");
     test_GetTextMetrics();
+    test_GdiRealizationInfo();
 }




More information about the wine-cvs mailing list