mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 11:40:30 +00:00
gdiplus/metafile: Added support for EmfPlusFont objects.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Vincent Povirk <vincent@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b203b76190
commit
7b99fe6f09
|
@ -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
|
||||||
} 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)
|
||||||
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
|
||||||
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;
|
||||||
|
|
Loading…
Reference in a new issue