Adam Petaccia : gdiplus: Implement GdipCloneFontFamily.
Alexandre Julliard
julliard at winehq.org
Mon Jul 7 09:19:32 CDT 2008
Module: wine
Branch: master
Commit: 638f63d13f7a046d13ad0b69018af372c63f79eb
URL: http://source.winehq.org/git/wine.git/?a=commit;h=638f63d13f7a046d13ad0b69018af372c63f79eb
Author: Adam Petaccia <adam at tpetaccia.com>
Date: Thu Jul 3 14:26:22 2008 -0400
gdiplus: Implement GdipCloneFontFamily.
---
dlls/gdiplus/font.c | 19 +++++++++++++++++--
dlls/gdiplus/tests/font.c | 11 ++++++++++-
2 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c
index 6ad0502..0919b66 100644
--- a/dlls/gdiplus/font.c
+++ b/dlls/gdiplus/font.c
@@ -411,10 +411,25 @@ GpStatus WINGDIPAPI GdipCloneFontFamily(GpFontFamily* FontFamily, GpFontFamily**
{
if (!(FontFamily && clonedFontFamily)) return InvalidParameter;
- FIXME("stub: %p (%s), %p\n", FontFamily,
+ TRACE("stub: %p (%s), %p\n", FontFamily,
debugstr_w(FontFamily->FamilyName), clonedFontFamily);
- return NotImplemented;
+ *clonedFontFamily = GdipAlloc(sizeof(GpFontFamily));
+ if (!*clonedFontFamily) return OutOfMemory;
+
+ **clonedFontFamily = *FontFamily;
+
+ (*clonedFontFamily)->FamilyName = GdipAlloc(sizeof(WCHAR) * LF_FACESIZE);
+ if (!(*clonedFontFamily)->FamilyName)
+ {
+ GdipFree (clonedFontFamily);
+ return OutOfMemory;
+ }
+
+ lstrcpynW((*clonedFontFamily)->FamilyName, FontFamily->FamilyName,
+ LF_FACESIZE);
+
+ return Ok;
}
/*******************************************************************************
diff --git a/dlls/gdiplus/tests/font.c b/dlls/gdiplus/tests/font.c
index 2178c84..0aa597d 100644
--- a/dlls/gdiplus/tests/font.c
+++ b/dlls/gdiplus/tests/font.c
@@ -150,7 +150,7 @@ static void test_logfont(void)
static void test_fontfamily (void)
{
- GpFontFamily* family;
+ GpFontFamily *family, *clonedFontFamily;
WCHAR itsName[LF_FACESIZE];
GpStatus stat;
@@ -180,7 +180,16 @@ static void test_fontfamily (void)
expect (Ok, stat);
}
+ /* Make sure we don't read old data */
+ ZeroMemory (itsName, sizeof(itsName));
+ stat = GdipCloneFontFamily(family, &clonedFontFamily);
+ expect (Ok, stat);
GdipDeleteFontFamily(family);
+ stat = GdipGetFamilyName(clonedFontFamily, itsName, LANG_NEUTRAL);
+ expect(Ok, stat);
+ expect(0, lstrcmpiW(itsName, arial));
+
+ GdipDeleteFontFamily(clonedFontFamily);
}
More information about the wine-cvs
mailing list