gdiplus: Implement GdipPrivateAddFontFile.

oldstable
Dmitry Timoshkov 2013-11-06 12:44:21 +09:00 committed by Alexandre Julliard
parent 6278f5ffdc
commit e7f6d77919
1 changed files with 29 additions and 5 deletions

View File

@ -1127,15 +1127,39 @@ GpStatus WINGDIPAPI GdipDeletePrivateFontCollection(GpFontCollection **fontColle
/*****************************************************************************
* GdipPrivateAddFontFile [GDIPLUS.@]
*/
GpStatus WINGDIPAPI GdipPrivateAddFontFile(GpFontCollection* fontCollection,
GDIPCONST WCHAR* filename)
GpStatus WINGDIPAPI GdipPrivateAddFontFile(GpFontCollection *collection, GDIPCONST WCHAR *name)
{
FIXME("stub: %p, %s\n", fontCollection, debugstr_w(filename));
HANDLE file, mapping;
LARGE_INTEGER size;
void *mem;
GpStatus status;
if (!(fontCollection && filename))
TRACE("%p, %s\n", collection, debugstr_w(name));
if (!collection || !name) return InvalidParameter;
file = CreateFileW(name, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
if (file == INVALID_HANDLE_VALUE) return InvalidParameter;
if (!GetFileSizeEx(file, &size) || size.u.HighPart)
{
CloseHandle(file);
return InvalidParameter;
}
return NotImplemented;
mapping = CreateFileMappingW(file, NULL, PAGE_READONLY, 0, 0, NULL);
CloseHandle(file);
if (!mapping) return InvalidParameter;
mem = MapViewOfFile(mapping, FILE_MAP_READ, 0, 0, 0);
CloseHandle(mapping);
if (!mem) return InvalidParameter;
/* GdipPrivateAddMemoryFont creates a copy of the memory block */
status = GdipPrivateAddMemoryFont(collection, mem, size.u.LowPart);
UnmapViewOfFile(mem);
return status;
}
#define TT_PLATFORM_APPLE_UNICODE 0