Commit 2d6a23be authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

gdi32: Implement GetFontFileData().

parent 93eca9e9
...@@ -8575,6 +8575,36 @@ static BOOL freetype_GetFontRealizationInfo( PHYSDEV dev, void *ptr ) ...@@ -8575,6 +8575,36 @@ static BOOL freetype_GetFontRealizationInfo( PHYSDEV dev, void *ptr )
} }
/************************************************************************* /*************************************************************************
* GetFontFileData (GDI32.@)
*/
BOOL WINAPI GetFontFileData( DWORD instance_id, DWORD unknown, UINT64 offset, void *buff, DWORD buff_size )
{
struct font_handle_entry *entry = handle_entry( instance_id );
DWORD tag = 0, size;
GdiFont *font;
if (!entry)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
font = entry->obj;
if (font->ttc_item_offset)
tag = MS_TTCF_TAG;
size = get_font_data( font, tag, 0, NULL, 0 );
if (size < buff_size || offset > size - buff_size)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
/* For now this only works for SFNT case. */
return get_font_data( font, tag, offset, buff, buff_size ) != 0;
}
/*************************************************************************
* GetFontFileInfo (GDI32.@) * GetFontFileInfo (GDI32.@)
*/ */
BOOL WINAPI GetFontFileInfo( DWORD instance_id, DWORD unknown, struct font_fileinfo *info, SIZE_T size, SIZE_T *needed ) BOOL WINAPI GetFontFileInfo( DWORD instance_id, DWORD unknown, struct font_fileinfo *info, SIZE_T size, SIZE_T *needed )
...@@ -9041,6 +9071,14 @@ BOOL WINAPI GetRasterizerCaps( LPRASTERIZER_STATUS lprs, UINT cbNumBytes) ...@@ -9041,6 +9071,14 @@ 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 )
{
return FALSE;
}
/*************************************************************************
* GetFontFileInfo (GDI32.@) * GetFontFileInfo (GDI32.@)
*/ */
BOOL WINAPI GetFontFileInfo( DWORD instance_id, DWORD unknown, struct font_fileinfo *info, DWORD size, DWORD *needed) BOOL WINAPI GetFontFileInfo( DWORD instance_id, DWORD unknown, struct font_fileinfo *info, DWORD size, DWORD *needed)
......
...@@ -281,6 +281,7 @@ ...@@ -281,6 +281,7 @@
@ stdcall GetEnhMetaFileW(wstr) @ stdcall GetEnhMetaFileW(wstr)
# @ stub GetFontAssocStatus # @ stub GetFontAssocStatus
@ stdcall GetFontData(long long long ptr long) @ stdcall GetFontData(long long long ptr long)
@ stdcall GetFontFileData(long long int64 ptr long)
@ stdcall GetFontFileInfo(long long ptr long ptr) @ stdcall GetFontFileInfo(long long ptr long ptr)
@ stdcall GetFontLanguageInfo(long) @ stdcall GetFontLanguageInfo(long)
@ stdcall GetFontRealizationInfo(long ptr) @ stdcall GetFontRealizationInfo(long ptr)
......
...@@ -61,7 +61,7 @@ static INT (WINAPI *pAddFontResourceExA)(LPCSTR, DWORD, PVOID); ...@@ -61,7 +61,7 @@ static INT (WINAPI *pAddFontResourceExA)(LPCSTR, DWORD, PVOID);
static BOOL (WINAPI *pRemoveFontResourceExA)(LPCSTR, DWORD, PVOID); static BOOL (WINAPI *pRemoveFontResourceExA)(LPCSTR, DWORD, PVOID);
static BOOL (WINAPI *pGetFontRealizationInfo)(HDC hdc, DWORD *); static BOOL (WINAPI *pGetFontRealizationInfo)(HDC hdc, DWORD *);
static BOOL (WINAPI *pGetFontFileInfo)(DWORD, DWORD, void *, SIZE_T, SIZE_T *); static BOOL (WINAPI *pGetFontFileInfo)(DWORD, DWORD, void *, SIZE_T, SIZE_T *);
static BOOL (WINAPI *pGetFontFileData)(DWORD, DWORD, ULONGLONG, void *, DWORD); static BOOL (WINAPI *pGetFontFileData)(DWORD, DWORD, UINT64, void *, DWORD);
static HMODULE hgdi32 = 0; static HMODULE hgdi32 = 0;
static const MAT2 mat = { {0,1}, {0,0}, {0,0}, {0,1} }; static const MAT2 mat = { {0,1}, {0,0}, {0,0}, {0,1} };
...@@ -4402,14 +4402,12 @@ static void test_RealizationInfo(void) ...@@ -4402,14 +4402,12 @@ static void test_RealizationInfo(void)
ok(r == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "ret %d gle %d\n", r, GetLastError()); ok(r == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "ret %d gle %d\n", r, GetLastError());
} }
if (pGetFontFileData) {
/* Get bytes 2 - 16 using GetFontFileData */ /* Get bytes 2 - 16 using GetFontFileData */
r = pGetFontFileData(fri->instance_id, 0, 2, data, sizeof(data)); r = pGetFontFileData(fri->instance_id, 0, 2, data, sizeof(data));
ok(r != 0, "ret 0 gle %d\n", GetLastError()); ok(r != 0, "ret 0 gle %d\n", GetLastError());
ok(!memcmp(data, file + 2, sizeof(data)), "mismatch\n"); ok(!memcmp(data, file + 2, sizeof(data)), "mismatch\n");
} }
}
DeleteObject(SelectObject(hdc, hfont_old)); DeleteObject(SelectObject(hdc, hfont_old));
...@@ -5144,8 +5142,6 @@ static void test_realization_info(const char *name, DWORD size, BOOL is_memory_r ...@@ -5144,8 +5142,6 @@ static void test_realization_info(const char *name, DWORD size, BOOL is_memory_r
wine_dbgstr_w(file_info.path)); wine_dbgstr_w(file_info.path));
} }
if (pGetFontFileData)
{
size = file_info.size.LowPart; size = file_info.size.LowPart;
data = HeapAlloc(GetProcessHeap(), 0, size + 16); data = HeapAlloc(GetProcessHeap(), 0, size + 16);
...@@ -5177,11 +5173,12 @@ if (pGetFontFileData) ...@@ -5177,11 +5173,12 @@ if (pGetFontFileData)
/* Zero buffer size. */ /* Zero buffer size. */
memset(data, 0xcc, size); memset(data, 0xcc, size);
ret = pGetFontFileData(info.instance_id, 0, 16, data, 0); ret = pGetFontFileData(info.instance_id, 0, 16, data, 0);
todo_wine
ok(ret == 0 && GetLastError() == ERROR_NOACCESS, "Unexpected return value %d, error %d\n", ret, GetLastError()); ok(ret == 0 && GetLastError() == ERROR_NOACCESS, "Unexpected return value %d, error %d\n", ret, GetLastError());
ok(*(DWORD *)data == 0xcccccccc, "Unexpected buffer contents %#x.\n", *(DWORD *)data); ok(*(DWORD *)data == 0xcccccccc, "Unexpected buffer contents %#x.\n", *(DWORD *)data);
HeapFree(GetProcessHeap(), 0, data); HeapFree(GetProcessHeap(), 0, data);
}
SelectObject(hdc, hfont_prev); SelectObject(hdc, hfont_prev);
DeleteObject(hfont); DeleteObject(hfont);
ReleaseDC(NULL, hdc); ReleaseDC(NULL, hdc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment