[2/2] gdiplus: GdipGetFontStyle

Nikolay Sivov bunglehead at gmail.com
Tue Apr 22 16:13:21 CDT 2008


Changelog:
    - implemented GdipGetFontStyle

---
 dlls/gdiplus/font.c       |   20 ++++++++++++++++++++
 dlls/gdiplus/gdiplus.spec |    2 +-
 include/gdiplusenums.h    |   11 +++++++++++
 include/gdiplusflat.h     |    1 +
 4 files changed, 33 insertions(+), 1 deletions(-)

diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c
index be60843..e3bfdc1 100644
--- a/dlls/gdiplus/font.c
+++ b/dlls/gdiplus/font.c
@@ -99,3 +99,23 @@ GpStatus WINGDIPAPI GdipGetLogFontW(GpFont *font, GpGraphics *graphics,
 
     return Ok;
 }
+
+GpStatus WINGDIPAPI GdipGetFontStyle(GpFont *font, INT *style)
+{
+    FontStyle fontStyle = FontStyleRegular;
+
+    if(!font || !style)
+        return InvalidParameter;
+
+    fontStyle |= (font->lfw.lfStrikeOut? FontStyleStrikeOut : 0);
+    fontStyle |= (font->lfw.lfUnderline? FontStyleUnderline : 0);
+    fontStyle |= (font->lfw.lfItalic   ? FontStyleItalic    : 0);
+    /* bold */
+    fontStyle |= (font->lfw.lfWeight >= FW_BOLD ? FontStyleBold : 0);
+    if((fontStyle & FontStyleItalic) && (fontStyle & FontStyleBold))
+        fontStyle |= FontStyleBoldItalic;
+    
+    *style = fontStyle;    
+    
+    return Ok;
+}
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index cbea1b9..3d1391c 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -270,7 +270,7 @@
 @ stub GdipGetFontHeight
 @ stub GdipGetFontHeightGivenDPI
 @ stub GdipGetFontSize
-@ stub GdipGetFontStyle
+@ stdcall GdipGetFontStyle(ptr ptr)
 @ stub GdipGetFontUnit
 @ stub GdipGetGenericFontFamilyMonospace
 @ stub GdipGetGenericFontFamilySansSerif
diff --git a/include/gdiplusenums.h b/include/gdiplusenums.h
index b0d9884..1c11912 100644
--- a/include/gdiplusenums.h
+++ b/include/gdiplusenums.h
@@ -280,6 +280,16 @@ enum CombineMode
     CombineModeComplement
 };
 
+enum FontStyle
+{
+    FontStyleRegular    = 0,
+    FontStyleBold       = 1,
+    FontStyleItalic     = 2,
+    FontStyleBoldItalic = 3,
+    FontStyleUnderline  = 4,
+    FontStyleStrikeOut  = 8
+};
+
 #ifndef __cplusplus
 
 typedef enum Unit Unit;
@@ -310,6 +320,7 @@ typedef enum HotkeyPrefix HotkeyPrefix;
 typedef enum PenAlignment GpPenAlignment;
 typedef enum ImageCodecFlags ImageCodecFlags;
 typedef enum CombineMode CombineMode;
+typedef enum FontStyle FontStyle;
 
 #endif /* end of c typedefs */
 
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index a8f6568..58b3181 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -313,6 +313,7 @@ GpStatus WINGDIPAPI GdipCreateFontFromLogfontA(HDC,GDIPCONST LOGFONTA*,GpFont**)
 GpStatus WINGDIPAPI GdipCreateFontFromLogfontW(HDC,GDIPCONST LOGFONTW*,GpFont**);
 GpStatus WINGDIPAPI GdipDeleteFont(GpFont*);
 GpStatus WINGDIPAPI GdipGetLogFontW(GpFont*,GpGraphics*,LOGFONTW*);
+GpStatus WINGDIPAPI GdipGetFontStyle(GpFont*,INT*);
 
 GpStatus WINGDIPAPI GdipCreateStringFormat(INT,LANGID,GpStringFormat**);
 GpStatus WINGDIPAPI GdipDeleteStringFormat(GpStringFormat*);
-- 
1.4.4.4

     1. 




More information about the wine-patches mailing list