[PATCH 1/2] Implement GdipGetLogFontA (try2)
Adam Petaccia
adam at tpetaccia.com
Sun Nov 9 13:04:07 CST 2008
Changelog:
try2:
Fix memcpy() use
Add prototype to gdiplusflat.h
Add documentation
---
dlls/gdiplus/font.c | 36 ++++++++++++++++++++++++++++++++++++
dlls/gdiplus/gdiplus.spec | 2 +-
include/gdiplusflat.h | 1 +
3 files changed, 38 insertions(+), 1 deletions(-)
diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c
index 32713c7..6f7ec67 100644
--- a/dlls/gdiplus/font.c
+++ b/dlls/gdiplus/font.c
@@ -368,6 +368,42 @@ GpStatus WINGDIPAPI GdipGetFontUnit(GpFont *font, Unit *unit)
}
/*******************************************************************************
+ * GdipGetLogFontA [GDIPLUS.@]
+ *
+ * Converts a font into a LOGFONTA
+ *
+ * PARAMS
+ * font [I] GpFont to create LOGFONTA object from
+ * graphics [I] Current graphics context
+ * lfa [O] Resulting LOGFONTA object
+ * RETURNS
+ * InvalidParameter: font, graphics, or lfa was NULL.
+ * GenericError: if there was an error converting character sets
+ * Ok: otherwise
+ */
+GpStatus WINGDIPAPI GdipGetLogFontA(GpFont *font, GpGraphics *graphics,
+ LOGFONTA *lfa)
+{
+ INT bytesWritten;
+ /* FIXME: use graphics */
+ if(!(font && graphics && lfa))
+ return InvalidParameter;
+
+ memcpy(lfa, &font->lfw, sizeof(LOGFONTA));
+ bytesWritten = WideCharToMultiByte(CP_ACP, 0, font->lfw.lfFaceName, -1,
+ lfa->lfFaceName, LF_FACESIZE, NULL, NULL);
+
+ if (bytesWritten == 0)
+ {
+ ERR("Could not convert from WideChar to Multibyte with error %d\n",
+ GetLastError());
+ return GenericError;
+ }
+
+ return Ok;
+}
+
+/*******************************************************************************
* GdipGetLogFontW [GDIPLUS.@]
*/
GpStatus WINGDIPAPI GdipGetLogFontW(GpFont *font, GpGraphics *graphics,
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index a2790a3..0e7ac5c 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 203bcec..6d2053b 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