gdi32: Implement GetFontFileData().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
93eca9e919
commit
2d6a23bef6
|
@ -8574,6 +8574,36 @@ static BOOL freetype_GetFontRealizationInfo( PHYSDEV dev, void *ptr )
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* 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.@)
|
||||
*/
|
||||
|
@ -9040,6 +9070,14 @@ BOOL WINAPI GetRasterizerCaps( LPRASTERIZER_STATUS lprs, UINT cbNumBytes)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* GetFontFileData (GDI32.@)
|
||||
*/
|
||||
BOOL WINAPI GetFontFileData( DWORD instance_id, DWORD unknown, UINT64 offset, void *buff, DWORD buff_size )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* GetFontFileInfo (GDI32.@)
|
||||
*/
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -61,7 +61,7 @@ static INT (WINAPI *pAddFontResourceExA)(LPCSTR, DWORD, PVOID);
|
|||
static BOOL (WINAPI *pRemoveFontResourceExA)(LPCSTR, DWORD, PVOID);
|
||||
static BOOL (WINAPI *pGetFontRealizationInfo)(HDC hdc, DWORD *);
|
||||
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 const MAT2 mat = { {0,1}, {0,0}, {0,0}, {0,1} };
|
||||
|
@ -4402,14 +4402,12 @@ 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());
|
||||
|
||||
ok(!memcmp(data, file + 2, sizeof(data)), "mismatch\n");
|
||||
}
|
||||
}
|
||||
|
||||
DeleteObject(SelectObject(hdc, hfont_old));
|
||||
|
||||
|
@ -5144,8 +5142,6 @@ static void test_realization_info(const char *name, DWORD size, BOOL is_memory_r
|
|||
wine_dbgstr_w(file_info.path));
|
||||
}
|
||||
|
||||
if (pGetFontFileData)
|
||||
{
|
||||
size = file_info.size.LowPart;
|
||||
data = HeapAlloc(GetProcessHeap(), 0, size + 16);
|
||||
|
||||
|
@ -5177,11 +5173,12 @@ if (pGetFontFileData)
|
|||
/* Zero buffer size. */
|
||||
memset(data, 0xcc, size);
|
||||
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(*(DWORD *)data == 0xcccccccc, "Unexpected buffer contents %#x.\n", *(DWORD *)data);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, data);
|
||||
}
|
||||
|
||||
SelectObject(hdc, hfont_prev);
|
||||
DeleteObject(hfont);
|
||||
ReleaseDC(NULL, hdc);
|
||||
|
|
Loading…
Reference in New Issue