[PATCH 1/2] Implement GdipGetLogFontA (try3)
Adam Petaccia
adam at tpetaccia.com
Tue Nov 11 10:24:17 CST 2008
Changelog:
try3:
Only copy the bytes we'll use
Toss out bytesWritten
try2:
Fix memcpy() use
Add documentation
Add testcase
---
dlls/gdiplus/font.c | 27 +++++++++++++++++++++++++++
dlls/gdiplus/gdiplus.spec | 2 +-
include/gdiplusflat.h | 1 +
3 files changed, 29 insertions(+), 1 deletions(-)
diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c
index 32713c7..7f815b6 100644
--- a/dlls/gdiplus/font.c
+++ b/dlls/gdiplus/font.c
@@ -368,6 +368,33 @@ GpStatus WINGDIPAPI GdipGetFontUnit(GpFont *font, Unit *unit)
}
/*******************************************************************************
+ * GdipGetLogFontA [GDIPLUS.@]
+ *
+ * Converts a font into a LOGFONTA
+ *
+ * PARAMS
+ * font [I] GpFont to create LOGFONTA object
+ * graphics [I] Current graphics context
+ * lfa [O] Resulting LOGFONTA object
+ * RETURNS
+ * InvalidParameter: font, graphics, or lfa was NULL.
+ * Ok: otherwise
+ */
+GpStatus WINGDIPAPI GdipGetLogFontA(GpFont *font, GpGraphics *graphics,
+ LOGFONTA *lfa)
+{
+ /* FIXME: use graphics */
+ if(!(font && graphics && lfa))
+ return InvalidParameter;
+
+ memcpy(lfa, &font->lfw, FIELD_OFFSET(LOGFONTA, lfFaceName));
+ WideCharToMultiByte(CP_ACP, 0, font->lfw.lfFaceName, -1,
+ lfa->lfFaceName, LF_FACESIZE, NULL, NULL);
+
+ return Ok;
+}
+
+/*******************************************************************************
* GdipGetLogFontW [GDIPLUS.@]
*/
GpStatus WINGDIPAPI GdipGetLogFontW(GpFont *font, GpGraphics *graphics,
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index c25d4b7..dce558c 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -311,7 +311,7 @@
@ stdcall GdipGetLineSpacing(ptr long ptr)
@ stub GdipGetLineTransform
@ stdcall GdipGetLineWrapMode(ptr ptr)
-@ stub GdipGetLogFontA
+@ stdcall GdipGetLogFontA(ptr ptr ptr)
@ stdcall GdipGetLogFontW(ptr ptr ptr)
@ stdcall GdipGetMatrixElements(ptr ptr)
@ stub GdipGetMetafileDownLevelRasterizationLimit
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index ea4bec5..a2c6fc9 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -81,6 +81,7 @@ GpStatus WINGDIPAPI GdipCreateFontFromDC(HDC,GpFont**);
GpStatus WINGDIPAPI GdipCreateFontFromLogfontA(HDC,GDIPCONST LOGFONTA*,GpFont**);
GpStatus WINGDIPAPI GdipCreateFontFromLogfontW(HDC,GDIPCONST LOGFONTW*,GpFont**);
GpStatus WINGDIPAPI GdipDeleteFont(GpFont*);
+GpStatus WINGDIPAPI GdipGetLogFontA(GpFont*,GpGraphics*,LOGFONTA*);
GpStatus WINGDIPAPI GdipGetLogFontW(GpFont*,GpGraphics*,LOGFONTW*);
GpStatus WINGDIPAPI GdipGetFamily(GpFont*, GpFontFamily**);
GpStatus WINGDIPAPI GdipGetFontUnit(GpFont*, Unit*);
--
1.5.6.3
More information about the wine-patches
mailing list