Commit 7b99fe6f authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

gdiplus/metafile: Added support for EmfPlusFont objects.

parent b203b761
...@@ -396,6 +396,7 @@ struct emfplus_object { ...@@ -396,6 +396,7 @@ struct emfplus_object {
GpBrush *brush; GpBrush *brush;
GpPath *path; GpPath *path;
GpImage *image; GpImage *image;
GpFont *font;
GpImageAttributes *image_attributes; GpImageAttributes *image_attributes;
void *object; void *object;
} u; } u;
......
...@@ -377,6 +377,17 @@ typedef struct EmfPlusFillPath ...@@ -377,6 +377,17 @@ typedef struct EmfPlusFillPath
} data; } data;
} EmfPlusFillPath; } EmfPlusFillPath;
typedef struct EmfPlusFont
{
DWORD Version;
float EmSize;
DWORD SizeUnit;
DWORD FontStyleFlags;
DWORD Reserved;
DWORD Length;
WCHAR FamilyName[1];
} EmfPlusFont;
static void metafile_free_object_table_entry(GpMetafile *metafile, BYTE id) static void metafile_free_object_table_entry(GpMetafile *metafile, BYTE id)
{ {
struct emfplus_object *object = &metafile->objtable[id]; struct emfplus_object *object = &metafile->objtable[id];
...@@ -394,6 +405,9 @@ static void metafile_free_object_table_entry(GpMetafile *metafile, BYTE id) ...@@ -394,6 +405,9 @@ static void metafile_free_object_table_entry(GpMetafile *metafile, BYTE id)
case ObjectTypeImage: case ObjectTypeImage:
GdipDisposeImage(object->u.image); GdipDisposeImage(object->u.image);
break; break;
case ObjectTypeFont:
GdipDeleteFont(object->u.font);
break;
case ObjectTypeImageAttributes: case ObjectTypeImageAttributes:
GdipDisposeImageAttributes(object->u.image_attributes); GdipDisposeImageAttributes(object->u.image_attributes);
break; break;
...@@ -1692,6 +1706,34 @@ static GpStatus METAFILE_PlaybackObject(GpMetafile *metafile, UINT flags, UINT d ...@@ -1692,6 +1706,34 @@ static GpStatus METAFILE_PlaybackObject(GpMetafile *metafile, UINT flags, UINT d
case ObjectTypeImage: case ObjectTypeImage:
status = metafile_deserialize_image(record_data, data_size, (GpImage **)&object); status = metafile_deserialize_image(record_data, data_size, (GpImage **)&object);
break; break;
case ObjectTypeFont:
{
EmfPlusFont *data = (EmfPlusFont *)record_data;
GpFontFamily *family;
WCHAR *familyname;
if (data_size <= FIELD_OFFSET(EmfPlusFont, FamilyName))
return InvalidParameter;
data_size -= FIELD_OFFSET(EmfPlusFont, FamilyName);
if (data_size < data->Length * sizeof(WCHAR))
return InvalidParameter;
if (!(familyname = GdipAlloc((data->Length + 1) * sizeof(*familyname))))
return OutOfMemory;
memcpy(familyname, data->FamilyName, data->Length * sizeof(*familyname));
familyname[data->Length] = 0;
status = GdipCreateFontFamilyFromName(familyname, NULL, &family);
GdipFree(familyname);
if (status != Ok)
return InvalidParameter;
status = GdipCreateFont(family, data->EmSize, data->FontStyleFlags, data->SizeUnit, (GpFont **)&object);
GdipDeleteFontFamily(family);
break;
}
case ObjectTypeImageAttributes: case ObjectTypeImageAttributes:
{ {
EmfPlusImageAttributes *data = (EmfPlusImageAttributes *)record_data; EmfPlusImageAttributes *data = (EmfPlusImageAttributes *)record_data;
......
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