diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index 6fd0968d175..f24f38e4262 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -110,6 +110,7 @@ extern GpStatus METAFILE_DrawImagePointsRect(GpMetafile* metafile, GpImage *imag GDIPCONST GpPointF *points, INT count, REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes* imageAttributes, DrawImageAbort callback, VOID *callbackData) DECLSPEC_HIDDEN; +extern GpStatus METAFILE_AddSimpleProperty(GpMetafile *metafile, SHORT prop, SHORT val) DECLSPEC_HIDDEN; extern void calc_curve_bezier(const GpPointF *pts, REAL tension, REAL *x1, REAL *y1, REAL *x2, REAL *y2) DECLSPEC_HIDDEN; diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 7ef0d111c19..7a6fcb1778b 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -5987,6 +5987,18 @@ GpStatus WINGDIPAPI GdipSetTextRenderingHint(GpGraphics *graphics, if(graphics->busy) return ObjectBusy; + if(graphics->texthint == hint) + return Ok; + + if(graphics->image && graphics->image->type == ImageTypeMetafile) { + GpStatus stat; + + stat = METAFILE_AddSimpleProperty((GpMetafile*)graphics->image, + EmfPlusRecordTypeSetTextRenderingHint, hint); + if(stat != Ok) + return stat; + } + graphics->texthint = hint; return Ok; diff --git a/dlls/gdiplus/metafile.c b/dlls/gdiplus/metafile.c index 1aafdf733aa..df87a66207e 100644 --- a/dlls/gdiplus/metafile.c +++ b/dlls/gdiplus/metafile.c @@ -2551,3 +2551,21 @@ GpStatus METAFILE_DrawImagePointsRect(GpMetafile *metafile, GpImage *image, METAFILE_WriteRecords(metafile); return Ok; } + +GpStatus METAFILE_AddSimpleProperty(GpMetafile *metafile, SHORT prop, SHORT val) +{ + EmfPlusRecordHeader *record; + GpStatus stat; + + if (metafile->metafile_type != MetafileTypeEmfPlusOnly && metafile->metafile_type != MetafileTypeEmfPlusDual) + return Ok; + + stat = METAFILE_AllocateRecord(metafile, sizeof(*record), (void**)&record); + if (stat != Ok) return stat; + + record->Type = prop; + record->Flags = val; + + METAFILE_WriteRecords(metafile); + return Ok; +}