From 37b8140f561f7ff9482c2483fc3e9385d47381bd Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Wed, 30 Apr 2008 18:19:42 +0400 Subject: [PATCH] gdiplus: 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 d5d7e944c0f..a05ef7530c3 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 bfab487a7d1..ec3897aede3 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 2cecd9979db..ddd4914fab0 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*);