gdiplus: implemented GdipCreateFontFromDC (see bug 12056)

Nikolay Sivov bunglehead at gmail.com
Wed Apr 30 09:19:42 CDT 2008


Changelog:
    - implemented GdipCreateFontFromDC
---
 dlls/gdiplus/font.c       |   18 ++++++++++++++++++
 dlls/gdiplus/gdiplus.spec |    6 +++---
 include/gdiplusflat.h     |    1 +
 3 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c
index d5d7e94..03f2fe7 100644
--- a/dlls/gdiplus/font.c
+++ b/dlls/gdiplus/font.c
@@ -88,6 +88,24 @@ GpStatus WINGDIPAPI GdipDeleteFont(GpFont* font)
     return Ok;
 }
 
+GpStatus WINGDIPAPI GdipCreateFontFromDC(HDC hdc, GpFont **font)
+{
+    HFONT hfont;
+    LOGFONTW lfw;
+    
+    if(!font)
+        return InvalidParameter;
+
+    hfont = (HFONT)GetCurrentObject(hdc, OBJ_FONT);
+    if(!hfont)
+        return GenericError;
+
+    if(!GetObjectW(hfont, sizeof(LOGFONTW), &lfw))
+        return GenericError;
+
+    return GdipCreateFontFromLogfontW(hdc, &lfw, font);
+}
+
 /* FIXME: use graphics */
 GpStatus WINGDIPAPI GdipGetLogFontW(GpFont *font, GpGraphics *graphics,
     LOGFONTW *lfw)
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index bfab487..ec3897a 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -86,9 +86,9 @@
 @ stub GdipCreateEffect
 @ stub GdipCreateFont
 @ stub GdipCreateFontFamilyFromName
-@ stub GdipCreateFontFromDC
-@ stdcall GdipCreateFontFromLogfontA(ptr ptr ptr)
-@ stdcall GdipCreateFontFromLogfontW(ptr ptr ptr)
+@ stdcall GdipCreateFontFromDC(long ptr)
+@ stdcall GdipCreateFontFromLogfontA(long ptr ptr)
+@ stdcall GdipCreateFontFromLogfontW(long ptr ptr)
 @ stdcall GdipCreateFromHDC2(long long ptr)
 @ stdcall GdipCreateFromHDC(long ptr)
 @ stdcall GdipCreateFromHWND(long ptr)
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index 2cecd99..ddd4914 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -330,6 +330,7 @@ GpStatus WINGDIPAPI GdipSetImageAttributesColorMatrix(GpImageAttributes*,
 GpStatus WINGDIPAPI GdipSetImageAttributesWrapMode(GpImageAttributes*,WrapMode,
     ARGB,BOOL);
 
+GpStatus WINGDIPAPI GdipCreateFontFromDC(HDC,GpFont**);
 GpStatus WINGDIPAPI GdipCreateFontFromLogfontA(HDC,GDIPCONST LOGFONTA*,GpFont**);
 GpStatus WINGDIPAPI GdipCreateFontFromLogfontW(HDC,GDIPCONST LOGFONTW*,GpFont**);
 GpStatus WINGDIPAPI GdipDeleteFont(GpFont*);
-- 
1.4.4.4






More information about the wine-patches mailing list