Commit 105caa28 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

gdi32: Implement CreateScalableFontResource.

Based on patches by Jeremy White and Dmitry Timoshkov.
parent 7ac623f3
......@@ -2873,28 +2873,14 @@ BOOL WINAPI CreateScalableFontResourceA( DWORD fHidden,
/***********************************************************************
* CreateScalableFontResourceW (GDI32.@)
*/
BOOL WINAPI CreateScalableFontResourceW( DWORD fHidden,
LPCWSTR lpszResourceFile,
LPCWSTR lpszFontFile,
LPCWSTR lpszCurrentPath )
{
HANDLE f;
FIXME("(%d,%s,%s,%s): stub\n",
fHidden, debugstr_w(lpszResourceFile), debugstr_w(lpszFontFile),
debugstr_w(lpszCurrentPath) );
/* fHidden=1 - only visible for the calling app, read-only, not
* enumerated with EnumFonts/EnumFontFamilies
* lpszCurrentPath can be NULL
*/
BOOL WINAPI CreateScalableFontResourceW( DWORD hidden, LPCWSTR resource_file,
LPCWSTR font_file, LPCWSTR font_path )
{
TRACE("(%d, %s, %s, %s)\n", hidden, debugstr_w(resource_file),
debugstr_w(font_file), debugstr_w(font_path) );
/* If the output file already exists, return the ERROR_FILE_EXISTS error as specified in MSDN */
if ((f = CreateFileW(lpszResourceFile, 0, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)) != INVALID_HANDLE_VALUE) {
CloseHandle(f);
SetLastError(ERROR_FILE_EXISTS);
return FALSE;
}
return FALSE; /* create failed */
return WineEngCreateScalableFontResource( hidden, resource_file,
font_file, font_path );
}
/*************************************************************************
......
......@@ -289,6 +289,7 @@ typedef struct
extern INT WineEngAddFontResourceEx(LPCWSTR, DWORD, PVOID) DECLSPEC_HIDDEN;
extern HANDLE WineEngAddFontMemResourceEx(PVOID, DWORD, PVOID, LPDWORD) DECLSPEC_HIDDEN;
extern BOOL WineEngCreateScalableFontResource(DWORD, LPCWSTR, LPCWSTR, LPCWSTR) DECLSPEC_HIDDEN;
extern BOOL WineEngDestroyFontInstance(HFONT handle) DECLSPEC_HIDDEN;
extern BOOL WineEngGetLinkedHFont(DC *dc, WCHAR c, HFONT *new_hfont, UINT *glyph) DECLSPEC_HIDDEN;
extern BOOL WineEngInit(void) DECLSPEC_HIDDEN;
......
......@@ -3989,13 +3989,11 @@ static void test_CreateScalableFontResource(void)
SetLastError(0xdeadbeef);
ret = CreateScalableFontResource(0, fot_name, "random file name", tmp_path);
ok(!ret, "CreateScalableFontResource() should fail\n");
todo_wine
ok(GetLastError() == ERROR_INVALID_PARAMETER, "not expected error %d\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CreateScalableFontResource(0, fot_name, NULL, ttf_name);
ok(!ret, "CreateScalableFontResource() should fail\n");
todo_wine
ok(GetLastError() == ERROR_INVALID_PARAMETER, "not expected error %d\n", GetLastError());
ret = DeleteFile(fot_name);
......
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