[PATCH 2/2] gdi32: Added GetFontRealizationInfo() export

Nikolay Sivov nsivov at codeweavers.com
Sat Aug 29 11:54:17 CDT 2015


---

-------------- next part --------------
From c7ac1ca10d78eb838f011f04cf5daf052f06e253 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov at codeweavers.com>
Date: Sat, 29 Aug 2015 19:51:02 +0300
Subject: [PATCH 2/2] gdi32: Added GetFontRealizationInfo() export

---
 dlls/gdi32/dibdrv/dc.c     |  4 ++--
 dlls/gdi32/driver.c        | 12 ++++++------
 dlls/gdi32/enhmfdrv/init.c |  2 +-
 dlls/gdi32/font.c          | 46 +++++++++++++++++++++++++++++++++++++++-------
 dlls/gdi32/freetype.c      | 18 ++++++++++++------
 dlls/gdi32/gdi32.spec      |  1 +
 dlls/gdi32/gdi_private.h   | 10 ++++++----
 dlls/gdi32/mfdrv/init.c    |  2 +-
 dlls/gdi32/path.c          |  2 +-
 dlls/gdi32/tests/font.c    |  2 ++
 dlls/winemac.drv/gdi.c     |  2 +-
 dlls/wineps.drv/init.c     |  2 +-
 dlls/winex11.drv/init.c    |  2 +-
 dlls/winex11.drv/xrender.c |  2 +-
 include/wine/gdi_driver.h  |  2 +-
 15 files changed, 76 insertions(+), 33 deletions(-)

diff --git a/dlls/gdi32/dibdrv/dc.c b/dlls/gdi32/dibdrv/dc.c
index 5ee1bd5..7203a8d 100644
--- a/dlls/gdi32/dibdrv/dc.c
+++ b/dlls/gdi32/dibdrv/dc.c
@@ -429,7 +429,6 @@ const struct gdi_dc_funcs dib_driver =
     NULL,                               /* pFontIsLinked */
     NULL,                               /* pFrameRgn */
     NULL,                               /* pGdiComment */
-    NULL,                               /* pGdiRealizationInfo */
     NULL,                               /* pGetBoundsRect */
     NULL,                               /* pGetCharABCWidths */
     NULL,                               /* pGetCharABCWidthsI */
@@ -437,6 +436,7 @@ const struct gdi_dc_funcs dib_driver =
     NULL,                               /* pGetDeviceCaps */
     NULL,                               /* pGetDeviceGammaRamp */
     NULL,                               /* pGetFontData */
+    NULL,                               /* pGetFontRealizationInfo */
     NULL,                               /* pGetFontUnicodeRanges */
     NULL,                               /* pGetGlyphIndices */
     NULL,                               /* pGetGlyphOutline */
@@ -1049,7 +1049,6 @@ static const struct gdi_dc_funcs window_driver =
     NULL,                               /* pFontIsLinked */
     NULL,                               /* pFrameRgn */
     NULL,                               /* pGdiComment */
-    NULL,                               /* pGdiRealizationInfo */
     NULL,                               /* pGetBoundsRect */
     NULL,                               /* pGetCharABCWidths */
     NULL,                               /* pGetCharABCWidthsI */
@@ -1057,6 +1056,7 @@ static const struct gdi_dc_funcs window_driver =
     NULL,                               /* pGetDeviceCaps */
     NULL,                               /* pGetDeviceGammaRamp */
     NULL,                               /* pGetFontData */
+    NULL,                               /* pGetFontRealizationInfo */
     NULL,                               /* pGetFontUnicodeRanges */
     NULL,                               /* pGetGlyphIndices */
     NULL,                               /* pGetGlyphOutline */
diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c
index ab39e41..a6b138c 100644
--- a/dlls/gdi32/driver.c
+++ b/dlls/gdi32/driver.c
@@ -276,11 +276,6 @@ static BOOL nulldrv_GdiComment( PHYSDEV dev, UINT size, const BYTE *data )
     return FALSE;
 }
 
-static BOOL nulldrv_GdiRealizationInfo( PHYSDEV dev, void *info )
-{
-    return FALSE;
-}
-
 static UINT nulldrv_GetBoundsRect( PHYSDEV dev, RECT *rect, UINT flags )
 {
     return DCB_RESET;
@@ -334,6 +329,11 @@ static DWORD nulldrv_GetFontData( PHYSDEV dev, DWORD table, DWORD offset, LPVOID
     return FALSE;
 }
 
+static BOOL nulldrv_GetFontRealizationInfo( PHYSDEV dev, void *info )
+{
+    return FALSE;
+}
+
 static DWORD nulldrv_GetFontUnicodeRanges( PHYSDEV dev, LPGLYPHSET glyphs )
 {
     return 0;
@@ -668,7 +668,6 @@ const struct gdi_dc_funcs null_driver =
     nulldrv_FontIsLinked,               /* pFontIsLinked */
     nulldrv_FrameRgn,                   /* pFrameRgn */
     nulldrv_GdiComment,                 /* pGdiComment */
-    nulldrv_GdiRealizationInfo,         /* pGdiRealizationInfo */
     nulldrv_GetBoundsRect,              /* pGetBoundsRect */
     nulldrv_GetCharABCWidths,           /* pGetCharABCWidths */
     nulldrv_GetCharABCWidthsI,          /* pGetCharABCWidthsI */
@@ -676,6 +675,7 @@ const struct gdi_dc_funcs null_driver =
     nulldrv_GetDeviceCaps,              /* pGetDeviceCaps */
     nulldrv_GetDeviceGammaRamp,         /* pGetDeviceGammaRamp */
     nulldrv_GetFontData,                /* pGetFontData */
+    nulldrv_GetFontRealizationInfo,     /* pGetFontRealizationInfo */
     nulldrv_GetFontUnicodeRanges,       /* pGetFontUnicodeRanges */
     nulldrv_GetGlyphIndices,            /* pGetGlyphIndices */
     nulldrv_GetGlyphOutline,            /* pGetGlyphOutline */
diff --git a/dlls/gdi32/enhmfdrv/init.c b/dlls/gdi32/enhmfdrv/init.c
index 682f412..34b3de6 100644
--- a/dlls/gdi32/enhmfdrv/init.c
+++ b/dlls/gdi32/enhmfdrv/init.c
@@ -69,7 +69,6 @@ static const struct gdi_dc_funcs EMFDRV_Funcs =
     NULL,                            /* pFontIsLinked */
     EMFDRV_FrameRgn,                 /* pFrameRgn */
     EMFDRV_GdiComment,               /* pGdiComment */
-    NULL,                            /* pGdiRealizationInfo */
     NULL,                            /* pGetBoundsRect */
     NULL,                            /* pGetCharABCWidths */
     NULL,                            /* pGetCharABCWidthsI */
@@ -77,6 +76,7 @@ static const struct gdi_dc_funcs EMFDRV_Funcs =
     EMFDRV_GetDeviceCaps,            /* pGetDeviceCaps */
     NULL,                            /* pGetDeviceGammaRamp */
     NULL,                            /* pGetFontData */
+    NULL,                            /* pGetFontRealizationInfo */
     NULL,                            /* pGetFontUnicodeRanges */
     NULL,                            /* pGetGlyphIndices */
     NULL,                            /* pGetGlyphOutline */
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 63de76b..fade4df 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -3846,19 +3846,51 @@ BOOL WINAPI FontIsLinked(HDC hdc)
 }
 
 /*************************************************************
- *           GdiRealizationInfo    (GDI32.@)
- *
- * Returns a structure that contains some font information.
+ *           GetFontRealizationInfo    (GDI32.@)
  */
-BOOL WINAPI GdiRealizationInfo(HDC hdc, realization_info_t *info)
+BOOL WINAPI GetFontRealizationInfo(HDC hdc, struct font_realization_info *info)
 {
-    DC *dc = get_dc_ptr(hdc);
+    BOOL is_v0 = info->size == FIELD_OFFSET(struct font_realization_info, unk);
     PHYSDEV dev;
     BOOL ret;
+    DC *dc;
+
+    if (info->size != sizeof(*info) && !is_v0)
+        return FALSE;
 
+    dc = get_dc_ptr(hdc);
     if (!dc) return FALSE;
-    dev = GET_DC_PHYSDEV( dc, pGdiRealizationInfo );
-    ret = dev->funcs->pGdiRealizationInfo( dev, info );
+    dev = GET_DC_PHYSDEV( dc, pGetFontRealizationInfo );
+    ret = dev->funcs->pGetFontRealizationInfo( dev, info );
     release_dc_ptr(dc);
     return ret;
 }
+
+struct realization_info
+{
+    DWORD flags;       /* 1 for bitmap fonts, 3 for scalable fonts */
+    DWORD cache_num;   /* keeps incrementing - num of fonts that have been created allowing for caching?? */
+    DWORD instance_id; /* identifies a realized font instance */
+};
+
+/*************************************************************
+ *           GdiRealizationInfo    (GDI32.@)
+ *
+ * Returns a structure that contains some font information.
+ */
+BOOL WINAPI GdiRealizationInfo(HDC hdc, struct realization_info *info)
+{
+    struct font_realization_info ri;
+    BOOL ret;
+
+    ri.size = sizeof(ri);
+    ret = GetFontRealizationInfo( hdc, &ri );
+    if (ret)
+    {
+        info->flags = ri.flags;
+        info->cache_num = ri.cache_num;
+        info->instance_id = ri.instance_id;
+    }
+
+    return ret;
+}
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index c67465a..60ffc45 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -8131,17 +8131,17 @@ BOOL WINAPI GetRasterizerCaps( LPRASTERIZER_STATUS lprs, UINT cbNumBytes)
 }
 
 /*************************************************************
- * freetype_GdiRealizationInfo
+ * freetype_GetFontRealizationInfo
  */
-static BOOL freetype_GdiRealizationInfo( PHYSDEV dev, void *ptr )
+static BOOL freetype_GetFontRealizationInfo( PHYSDEV dev, void *ptr )
 {
     struct freetype_physdev *physdev = get_freetype_dev( dev );
-    realization_info_t *info = ptr;
+    struct font_realization_info *info = ptr;
 
     if (!physdev->font)
     {
-        dev = GET_NEXT_PHYSDEV( dev, pGdiRealizationInfo );
-        return dev->funcs->pGdiRealizationInfo( dev, ptr );
+        dev = GET_NEXT_PHYSDEV( dev, pGetFontRealizationInfo );
+        return dev->funcs->pGetFontRealizationInfo( dev, ptr );
     }
 
     FIXME("(%p, %p): stub!\n", physdev->font, info);
@@ -8152,6 +8152,12 @@ static BOOL freetype_GdiRealizationInfo( PHYSDEV dev, void *ptr )
 
     info->cache_num = physdev->font->cache_num;
     info->instance_id = -1;
+    if (info->size == sizeof(*info))
+    {
+        info->unk = 0;
+        info->face_index = physdev->font->ft_face->face_index;
+    }
+
     return TRUE;
 }
 
@@ -8445,7 +8451,6 @@ static const struct gdi_dc_funcs freetype_funcs =
     freetype_FontIsLinked,              /* pFontIsLinked */
     NULL,                               /* pFrameRgn */
     NULL,                               /* pGdiComment */
-    freetype_GdiRealizationInfo,        /* pGdiRealizationInfo */
     NULL,                               /* pGetBoundsRect */
     freetype_GetCharABCWidths,          /* pGetCharABCWidths */
     freetype_GetCharABCWidthsI,         /* pGetCharABCWidthsI */
@@ -8453,6 +8458,7 @@ static const struct gdi_dc_funcs freetype_funcs =
     NULL,                               /* pGetDeviceCaps */
     NULL,                               /* pGetDeviceGammaRamp */
     freetype_GetFontData,               /* pGetFontData */
+    freetype_GetFontRealizationInfo,    /* pGetFontRealizationInfo */
     freetype_GetFontUnicodeRanges,      /* pGetFontUnicodeRanges */
     freetype_GetGlyphIndices,           /* pGetGlyphIndices */
     freetype_GetGlyphOutline,           /* pGetGlyphOutline */
diff --git a/dlls/gdi32/gdi32.spec b/dlls/gdi32/gdi32.spec
index 4ad1802..8bba686 100644
--- a/dlls/gdi32/gdi32.spec
+++ b/dlls/gdi32/gdi32.spec
@@ -280,6 +280,7 @@
 # @ stub GetFontAssocStatus
 @ stdcall GetFontData(long long long ptr long)
 @ stdcall GetFontLanguageInfo(long)
+@ stdcall GetFontRealizationInfo(long ptr)
 @ stub GetFontResourceInfo
 @ stdcall GetFontResourceInfoW(wstr ptr ptr long)
 @ stdcall GetFontUnicodeRanges(ptr ptr)
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index 2083606..2e52e08 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -276,14 +276,16 @@ extern HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk ) D
 
 /* freetype.c */
 
-/* Undocumented structure filled in by GdiRealizationInfo */
-typedef struct
+/* Undocumented structure filled in by GetFontRealizationInfo */
+struct font_realization_info
 {
+    DWORD size;        /* could be 16 or 24 */
     DWORD flags;       /* 1 for bitmap fonts, 3 for scalable fonts */
     DWORD cache_num;   /* keeps incrementing - num of fonts that have been created allowing for caching?? */
     DWORD instance_id; /* identifies a realized font instance */
-} realization_info_t;
-
+    DWORD unk;         /* unknown */
+    DWORD face_index;  /* face index in case of font collections */
+};
 
 extern INT WineEngAddFontResourceEx(LPCWSTR, DWORD, PVOID) DECLSPEC_HIDDEN;
 extern HANDLE WineEngAddFontMemResourceEx(PVOID, DWORD, PVOID, LPDWORD) DECLSPEC_HIDDEN;
diff --git a/dlls/gdi32/mfdrv/init.c b/dlls/gdi32/mfdrv/init.c
index 7b53244..50f8ba3 100644
--- a/dlls/gdi32/mfdrv/init.c
+++ b/dlls/gdi32/mfdrv/init.c
@@ -132,7 +132,6 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
     NULL,                            /* pFontIsLinked */
     MFDRV_FrameRgn,                  /* pFrameRgn */
     NULL,                            /* pGdiComment */
-    NULL,                            /* pGdiRealizationInfo */
     MFDRV_GetBoundsRect,             /* pGetBoundsRect */
     NULL,                            /* pGetCharABCWidths */
     NULL,                            /* pGetCharABCWidthsI */
@@ -140,6 +139,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
     MFDRV_GetDeviceCaps,             /* pGetDeviceCaps */
     NULL,                            /* pGetDeviceGammaRamp */
     NULL,                            /* pGetFontData */
+    NULL,                            /* pGetFontRealizationInfo */
     NULL,                            /* pGetFontUnicodeRanges */
     NULL,                            /* pGetGlyphIndices */
     NULL,                            /* pGetGlyphOutline */
diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c
index 2c54e94..e09cd0b 100644
--- a/dlls/gdi32/path.c
+++ b/dlls/gdi32/path.c
@@ -2251,7 +2251,6 @@ const struct gdi_dc_funcs path_driver =
     NULL,                               /* pFontIsLinked */
     NULL,                               /* pFrameRgn */
     NULL,                               /* pGdiComment */
-    NULL,                               /* pGdiRealizationInfo */
     NULL,                               /* pGetBoundsRect */
     NULL,                               /* pGetCharABCWidths */
     NULL,                               /* pGetCharABCWidthsI */
@@ -2259,6 +2258,7 @@ const struct gdi_dc_funcs path_driver =
     NULL,                               /* pGetDeviceCaps */
     NULL,                               /* pGetDeviceGammaRamp */
     NULL,                               /* pGetFontData */
+    NULL,                               /* pGetFontRealizationInfo */
     NULL,                               /* pGetFontUnicodeRanges */
     NULL,                               /* pGetGlyphIndices */
     NULL,                               /* pGetGlyphOutline */
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index fb603a4..3757a8d 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -4222,6 +4222,7 @@ static void test_RealizationInfo(void)
         ok(info2[6] == 0xcccccccc, "structure longer than 6 dwords\n");
 
         /* Test GetFontFileInfo() */
+    if (pGetFontFileInfo) {
         r = pGetFontFileInfo(fri->instance_id, 0, &file_info, sizeof(file_info), &needed);
         ok(r != 0 || GetLastError() == ERROR_NOACCESS, "ret %d gle %d\n", r, GetLastError());
 
@@ -4250,6 +4251,7 @@ static void test_RealizationInfo(void)
         else
             win_skip("GetFontFileInfo() failed, skipping\n");
     }
+    }
 
     DeleteObject(SelectObject(hdc, hfont_old));
 
diff --git a/dlls/winemac.drv/gdi.c b/dlls/winemac.drv/gdi.c
index 951b569..9f18ac4 100644
--- a/dlls/winemac.drv/gdi.c
+++ b/dlls/winemac.drv/gdi.c
@@ -444,7 +444,6 @@ static const struct gdi_dc_funcs macdrv_funcs =
     NULL,                                   /* pFontIsLinked */
     NULL,                                   /* pFrameRgn */
     NULL,                                   /* pGdiComment */
-    NULL,                                   /* pGdiRealizationInfo */
     NULL,                                   /* pGetBoundsRect */
     NULL,                                   /* pGetCharABCWidths */
     NULL,                                   /* pGetCharABCWidthsI */
@@ -452,6 +451,7 @@ static const struct gdi_dc_funcs macdrv_funcs =
     macdrv_GetDeviceCaps,                   /* pGetDeviceCaps */
     macdrv_GetDeviceGammaRamp,              /* pGetDeviceGammaRamp */
     NULL,                                   /* pGetFontData */
+    NULL,                                   /* pGetFontRealizationInfo */
     NULL,                                   /* pGetFontUnicodeRanges */
     NULL,                                   /* pGetGlyphIndices */
     NULL,                                   /* pGetGlyphOutline */
diff --git a/dlls/wineps.drv/init.c b/dlls/wineps.drv/init.c
index fde65c2..2cdb071 100644
--- a/dlls/wineps.drv/init.c
+++ b/dlls/wineps.drv/init.c
@@ -856,7 +856,6 @@ static const struct gdi_dc_funcs psdrv_funcs =
     NULL,                               /* pFontIsLinked */
     NULL,                               /* pFrameRgn */
     NULL,                               /* pGdiComment */
-    NULL,                               /* pGdiRealizationInfo */
     NULL,                               /* pGetBoundsRect */
     NULL,                               /* pGetCharABCWidths */
     NULL,                               /* pGetCharABCWidthsI */
@@ -864,6 +863,7 @@ static const struct gdi_dc_funcs psdrv_funcs =
     PSDRV_GetDeviceCaps,                /* pGetDeviceCaps */
     NULL,                               /* pGetDeviceGammaRamp */
     NULL,                               /* pGetFontData */
+    NULL,                               /* pGetFontRealizationInfo */
     NULL,                               /* pGetFontUnicodeRanges */
     NULL,                               /* pGetGlyphIndices */
     NULL,                               /* pGetGlyphOutline */
diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c
index 5a7d316..6bc4fb3 100644
--- a/dlls/winex11.drv/init.c
+++ b/dlls/winex11.drv/init.c
@@ -500,7 +500,6 @@ static const struct gdi_dc_funcs x11drv_funcs =
     NULL,                               /* pFontIsLinked */
     NULL,                               /* pFrameRgn */
     NULL,                               /* pGdiComment */
-    NULL,                               /* pGdiRealizationInfo */
     NULL,                               /* pGetBoundsRect */
     NULL,                               /* pGetCharABCWidths */
     NULL,                               /* pGetCharABCWidthsI */
@@ -508,6 +507,7 @@ static const struct gdi_dc_funcs x11drv_funcs =
     X11DRV_GetDeviceCaps,               /* pGetDeviceCaps */
     X11DRV_GetDeviceGammaRamp,          /* pGetDeviceGammaRamp */
     NULL,                               /* pGetFontData */
+    NULL,                               /* pGetFontRealizationInfo */
     NULL,                               /* pGetFontUnicodeRanges */
     NULL,                               /* pGetGlyphIndices */
     NULL,                               /* pGetGlyphOutline */
diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c
index d2a1c45..bc2ee40 100644
--- a/dlls/winex11.drv/xrender.c
+++ b/dlls/winex11.drv/xrender.c
@@ -2181,7 +2181,6 @@ static const struct gdi_dc_funcs xrender_funcs =
     NULL,                               /* pFontIsLinked */
     NULL,                               /* pFrameRgn */
     NULL,                               /* pGdiComment */
-    NULL,                               /* pGdiRealizationInfo */
     NULL,                               /* pGetBoundsRect */
     NULL,                               /* pGetCharABCWidths */
     NULL,                               /* pGetCharABCWidthsI */
@@ -2189,6 +2188,7 @@ static const struct gdi_dc_funcs xrender_funcs =
     NULL,                               /* pGetDeviceCaps */
     NULL,                               /* pGetDeviceGammaRamp */
     NULL,                               /* pGetFontData */
+    NULL,                               /* pGetFontRealizationInfo */
     NULL,                               /* pGetFontUnicodeRanges */
     NULL,                               /* pGetGlyphIndices */
     NULL,                               /* pGetGlyphOutline */
diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h
index 06e4caa..4a1574f 100644
--- a/include/wine/gdi_driver.h
+++ b/include/wine/gdi_driver.h
@@ -97,7 +97,6 @@ struct gdi_dc_funcs
     BOOL     (*pFontIsLinked)(PHYSDEV);
     BOOL     (*pFrameRgn)(PHYSDEV,HRGN,HBRUSH,INT,INT);
     BOOL     (*pGdiComment)(PHYSDEV,UINT,const BYTE*);
-    BOOL     (*pGdiRealizationInfo)(PHYSDEV,void*);
     UINT     (*pGetBoundsRect)(PHYSDEV,RECT*,UINT);
     BOOL     (*pGetCharABCWidths)(PHYSDEV,UINT,UINT,LPABC);
     BOOL     (*pGetCharABCWidthsI)(PHYSDEV,UINT,UINT,WORD*,LPABC);
@@ -105,6 +104,7 @@ struct gdi_dc_funcs
     INT      (*pGetDeviceCaps)(PHYSDEV,INT);
     BOOL     (*pGetDeviceGammaRamp)(PHYSDEV,LPVOID);
     DWORD    (*pGetFontData)(PHYSDEV,DWORD,DWORD,LPVOID,DWORD);
+    BOOL     (*pGetFontRealizationInfo)(PHYSDEV,void*);
     DWORD    (*pGetFontUnicodeRanges)(PHYSDEV,LPGLYPHSET);
     DWORD    (*pGetGlyphIndices)(PHYSDEV,LPCWSTR,INT,LPWORD,DWORD);
     DWORD    (*pGetGlyphOutline)(PHYSDEV,UINT,UINT,LPGLYPHMETRICS,DWORD,LPVOID,const MAT2*);
-- 
2.1.4



More information about the wine-patches mailing list