[PATCH] gdi32: Update font realization structure definition.

Nikolay Sivov nsivov at codeweavers.com
Mon Aug 2 12:46:35 CDT 2021


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---

I tested this with with Type 1 pfb/pfm font on Windows 10. Second argument is font file index,
that's clearly visible by inspecting returned file paths. PFB path is returned for index 0,
and PFM for index 1. For DirectWrite integration purposes we could use CreateFontFace() that takes
an array of file objects, but newer API additions like CreateFontFaceReference() do not use such model.
More importantly DirectWrite never supported Adobe formats, outside of sfnt container.

 dlls/dwrite/gdiinterop.c   | 12 +++++++-----
 dlls/dwrite/tests/font.c   |  2 +-
 dlls/gdi32/font.c          |  8 ++++----
 dlls/gdi32/ntgdi_private.h |  2 +-
 dlls/gdi32/tests/font.c    |  2 +-
 5 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/dlls/dwrite/gdiinterop.c b/dlls/dwrite/gdiinterop.c
index 6a5953a67e9..8df3f9f97ca 100644
--- a/dlls/dwrite/gdiinterop.c
+++ b/dlls/dwrite/gdiinterop.c
@@ -737,17 +737,19 @@ static HRESULT WINAPI gdiinterop_ConvertFontFaceToLOGFONT(IDWriteGdiInterop1 *if
     return S_OK;
 }
 
-struct font_realization_info {
+struct font_realization_info
+{
     DWORD size;
     DWORD flags;
     DWORD cache_num;
     DWORD instance_id;
-    DWORD unk;
+    DWORD file_count;
     WORD  face_index;
     WORD  simulations;
 };
 
-struct font_fileinfo {
+struct font_fileinfo
+{
     FILETIME writetime;
     LARGE_INTEGER size;
     WCHAR path[1];
@@ -755,8 +757,8 @@ struct font_fileinfo {
 
 /* Undocumented gdi32 exports, used to access actually selected font information */
 extern BOOL WINAPI GetFontRealizationInfo(HDC hdc, struct font_realization_info *info);
-extern BOOL WINAPI GetFontFileInfo(DWORD instance_id, DWORD unknown, struct font_fileinfo *info, SIZE_T size, SIZE_T *needed);
-extern BOOL WINAPI GetFontFileData(DWORD instance_id, DWORD unknown, UINT64 offset, void *buff, DWORD buff_size);
+extern BOOL WINAPI GetFontFileInfo(DWORD instance_id, DWORD file_index, struct font_fileinfo *info, SIZE_T size, SIZE_T *needed);
+extern BOOL WINAPI GetFontFileData(DWORD instance_id, DWORD file_index, UINT64 offset, void *buff, DWORD buff_size);
 
 static HRESULT WINAPI gdiinterop_CreateFontFaceFromHdc(IDWriteGdiInterop1 *iface,
     HDC hdc, IDWriteFontFace **fontface)
diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c
index 9f814504a44..be367463414 100644
--- a/dlls/dwrite/tests/font.c
+++ b/dlls/dwrite/tests/font.c
@@ -4276,7 +4276,7 @@ struct font_realization_info
     DWORD flags;
     DWORD cache_num;
     DWORD instance_id;
-    DWORD unk;
+    DWORD file_count;
     WORD  face_index;
     WORD  simulations;
 };
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 16d3bdf26ba..442c76fb026 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -3177,7 +3177,7 @@ static BOOL CDECL font_GetFontRealizationInfo( PHYSDEV dev, void *ptr )
     info->instance_id = physdev->font->handle;
     if (info->size == sizeof(*info))
     {
-        info->unk = 0;
+        info->file_count = 1;
         info->face_index = physdev->font->face_index;
         info->simulations = 0;
         if (physdev->font->fake_bold) info->simulations |= 0x1;
@@ -8304,7 +8304,7 @@ BOOL WINAPI FontIsLinked(HDC hdc)
  */
 BOOL WINAPI GetFontRealizationInfo(HDC hdc, struct font_realization_info *info)
 {
-    BOOL is_v0 = info->size == FIELD_OFFSET(struct font_realization_info, unk);
+    BOOL is_v0 = info->size == FIELD_OFFSET(struct font_realization_info, file_count);
     PHYSDEV dev;
     BOOL ret;
     DC *dc;
@@ -8334,7 +8334,7 @@ BOOL WINAPI GetRasterizerCaps( LPRASTERIZER_STATUS lprs, UINT cbNumBytes)
 /*************************************************************************
  *             GetFontFileData   (GDI32.@)
  */
-BOOL WINAPI GetFontFileData( DWORD instance_id, DWORD unknown, UINT64 offset, void *buff, DWORD buff_size )
+BOOL WINAPI GetFontFileData( DWORD instance_id, DWORD file_index, UINT64 offset, void *buff, DWORD buff_size )
 {
     struct gdi_font *font;
     DWORD tag = 0, size;
@@ -8366,7 +8366,7 @@ struct font_fileinfo
 /*************************************************************************
  *             GetFontFileInfo   (GDI32.@)
  */
-BOOL WINAPI GetFontFileInfo( DWORD instance_id, DWORD unknown, struct font_fileinfo *info,
+BOOL WINAPI GetFontFileInfo( DWORD instance_id, DWORD file_index, struct font_fileinfo *info,
                              SIZE_T size, SIZE_T *needed )
 {
     SIZE_T required_size = 0;
diff --git a/dlls/gdi32/ntgdi_private.h b/dlls/gdi32/ntgdi_private.h
index 203ad2181a1..37b86047922 100644
--- a/dlls/gdi32/ntgdi_private.h
+++ b/dlls/gdi32/ntgdi_private.h
@@ -290,7 +290,7 @@ struct font_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 */
-    DWORD unk;         /* unknown */
+    DWORD file_count;  /* number of files that make up this font */
     WORD  face_index;  /* face index in case of font collections */
     WORD  simulations; /* 0 bit - bold simulation, 1 bit - oblique simulation */
 };
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index 7aee0a86d23..ef1dc26595d 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -4334,7 +4334,7 @@ struct font_realization_info
     DWORD flags;
     DWORD cache_num;
     DWORD instance_id;
-    DWORD unk;
+    DWORD file_count;
     WORD  face_index;
     WORD  simulations;
 };
-- 
2.30.2




More information about the wine-devel mailing list