]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/fontutil.h
Applied notebook font patch.
[wxWidgets.git] / include / wx / fontutil.h
index da045f1c535341d7a88b2d908b5cad0a6e8232f9..5ff0cded08285c61db2e8ba71d83b231c72ecf62 100644 (file)
@@ -139,6 +139,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;