[PATCH 3/3] gdi32: Implement GetFontFileData().

Nikolay Sivov nsivov at codeweavers.com
Mon Nov 19 03:26:48 CST 2018


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/gdi32/freetype.c   | 14 ++++++++++++++
 dlls/gdi32/gdi32.spec   |  1 +
 dlls/gdi32/tests/font.c |  6 +-----
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index dfbbfa9d78..7f0668e9cd 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -8550,6 +8550,20 @@ static BOOL freetype_GetFontRealizationInfo( PHYSDEV dev, void *ptr )
     return TRUE;
 }
 
+BOOL WINAPI GetFontFileData( DWORD instance_id, DWORD unknown, ULONGLONG offset, void *buff, DWORD buff_size )
+{
+    struct font_handle_entry *entry = handle_entry( instance_id );
+
+    if (!entry)
+    {
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return FALSE;
+    }
+
+    /* For now this only works for SFNT case. */
+    return get_font_data( entry->obj, 0, offset, buff, buff_size ) != 0;
+}
+
 /*************************************************************************
  *             GetFontFileInfo   (GDI32.@)
  */
diff --git a/dlls/gdi32/gdi32.spec b/dlls/gdi32/gdi32.spec
index 2400a51038..2dc8f0e887 100644
--- a/dlls/gdi32/gdi32.spec
+++ b/dlls/gdi32/gdi32.spec
@@ -281,6 +281,7 @@
 @ stdcall GetEnhMetaFileW(wstr)
 # @ stub GetFontAssocStatus
 @ stdcall GetFontData(long long long ptr long)
+@ stdcall GetFontFileData(long long int64 ptr long)
 @ stdcall GetFontFileInfo(long long ptr long ptr)
 @ stdcall GetFontLanguageInfo(long)
 @ stdcall GetFontRealizationInfo(long ptr)
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index 5e97c9699f..e18e59ce80 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -4402,7 +4402,6 @@ static void test_RealizationInfo(void)
             ok(r == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "ret %d gle %d\n", r, GetLastError());
         }
 
-    if (pGetFontFileData) {
         /* Get bytes 2 - 16 using GetFontFileData */
         r = pGetFontFileData(fri->instance_id, 0, 2, data, sizeof(data));
         ok(r != 0, "ret 0 gle %d\n", GetLastError());
@@ -4412,7 +4411,6 @@ static void test_RealizationInfo(void)
         else
             win_skip("GetFontFileInfo() failed, skipping\n");
     }
-    }
 
     DeleteObject(SelectObject(hdc, hfont_old));
 
@@ -5128,13 +5126,11 @@ static void test_realization_info(const char *name, DWORD size, BOOL is_memory_r
             wine_dbgstr_w(file_info.path));
     }
 
-if (pGetFontFileData)
-{
     memset(data, 0xcc, sizeof(data));
     ret = pGetFontFileData(info.instance_id, 0, 16, data, sizeof(data));
     ok(ret != 0, "Failed to get font file data, %d\n", GetLastError());
     ok(*(DWORD *)data == 0x1000000, "Unexpected sfnt header version %#x.\n", *(DWORD *)data);
-}
+
     SelectObject(hdc, hfont_prev);
     DeleteObject(hfont);
     ReleaseDC(NULL, hdc);
-- 
2.19.1




More information about the wine-devel mailing list