]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/fontutil.h
MSVC 5 fix.
[wxWidgets.git] / include / wx / fontutil.h
index 5e9e14c09ba5f67af0c43bc6c68a53ba7424edfa..1f4f5c3c340d23a39256b3284c3514db7d28c813 100644 (file)
 #include "wx/font.h"        // for wxFont and wxFontEncoding
 
 #if defined(__WXMSW__)
-    #include <windows.h>
-    #include "wx/msw/winundef.h"
+    #include "wx/msw/wrapwin.h"
 #endif
 
+struct WXDLLEXPORT wxNativeEncodingInfo;
+
 #if defined(_WX_X_FONTLIKE)
 
 // the symbolic names for the XLFD fields (with examples for their value)
@@ -137,6 +138,28 @@ public:
     // reset to the default state
     void Init();
 
+    // init with the parameters of the given font
+    void InitFromFont(const wxFont& font)
+    {
+        // translate all font parameters
+        SetStyle((wxFontStyle)font.GetStyle());
+        SetWeight((wxFontWeight)font.GetWeight());
+        SetUnderlined(font.GetUnderlined());
+        SetPointSize(font.GetPointSize());
+
+        // set the family/facename
+        SetFamily((wxFontFamily)font.GetFamily());
+        const wxString& facename = font.GetFaceName();
+        if ( !facename.empty() )
+        {
+            SetFaceName(facename);
+        }
+
+        // deal with encoding now (it may override the font family and facename
+        // so do it after setting them)
+        SetEncoding(font.GetEncoding());
+    }
+
     // accessors and modifiers for the font elements
     int GetPointSize() const;
     wxFontStyle GetStyle() const;