]> git.saurik.com Git - wxWidgets.git/commitdiff
applied wxNativeFontInfo patch from Derry Bryson (with minor changes)
authorGilles Depeyrot <gilles_depeyrot@mac.com>
Sat, 20 Jan 2001 19:30:47 +0000 (19:30 +0000)
committerGilles Depeyrot <gilles_depeyrot@mac.com>
Sat, 20 Jan 2001 19:30:47 +0000 (19:30 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9134 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/mac/font.h
src/mac/carbon/font.cpp
src/mac/carbon/fontenum.cpp
src/mac/font.cpp
src/mac/fontenum.cpp

index 6b41fc9c61545ea0594bc5a2085fa5219210262d..e65149037e90a6ac88b85ed0d2402464ea824aa8 100644 (file)
@@ -100,6 +100,15 @@ public:
         (void)Create(size, family, style, weight, underlined, face, encoding);
     }
 
+    wxFont(const wxNativeFontInfo& info)
+    {
+        Init();
+
+        (void)Create(info);
+    }
+
+    wxFont(const wxString& fontDesc);
+
     bool Create(int size,
                 int family,
                 int style,
@@ -108,6 +117,8 @@ public:
                 const wxString& face = wxEmptyString,
                 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
 
+    bool Create(const wxNativeFontInfo& info);
+
     virtual ~wxFont();
 
     // assignment
index 4f26c04f914e3bfab6d22d3655d28981ec364b68..ecffc9fd941d59244dc5d710d92340b785981080 100644 (file)
 #include "wx/font.h"
 #include "wx/gdicmn.h"
 
+#include "wx/fontutil.h"
+
 #if !USE_SHARED_LIBRARIES
 IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
 #endif
 
-
-
-
 // ============================================================================
 // implementation
 // ============================================================================
@@ -120,6 +119,13 @@ void wxFont::Init()
         wxTheFontList->Append(this);
 }
 
+wxFont::wxFont(const wxString& fontdesc)
+{
+    wxNativeFontInfo info;
+    if ( info.FromString(fontdesc) )
+        (void)Create(info);
+}
+
 bool wxFont::Create(int pointSize,
                     int family,
                     int style,
@@ -137,6 +143,12 @@ bool wxFont::Create(int pointSize,
     return TRUE;
 }
 
+bool wxFont::Create(const wxNativeFontInfo& info)
+{
+    return Create(info.pointSize, info.family, info.style, info.weight,
+                  info.underlined, info.faceName, info.encoding);
+}
+
 wxFont::~wxFont()
 {
     if (wxTheFontList)
index f296efd93cb19bb41fc9923e166e7fbb6f7161f8..99cd68441ad9de7641580d276309485476ad105b 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "wx/fontenum.h"
 #include "wx/fontmap.h"
+#include "wx/fontutil.h"
 
 // ----------------------------------------------------------------------------
 // private classes
index 4f26c04f914e3bfab6d22d3655d28981ec364b68..ecffc9fd941d59244dc5d710d92340b785981080 100644 (file)
 #include "wx/font.h"
 #include "wx/gdicmn.h"
 
+#include "wx/fontutil.h"
+
 #if !USE_SHARED_LIBRARIES
 IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
 #endif
 
-
-
-
 // ============================================================================
 // implementation
 // ============================================================================
@@ -120,6 +119,13 @@ void wxFont::Init()
         wxTheFontList->Append(this);
 }
 
+wxFont::wxFont(const wxString& fontdesc)
+{
+    wxNativeFontInfo info;
+    if ( info.FromString(fontdesc) )
+        (void)Create(info);
+}
+
 bool wxFont::Create(int pointSize,
                     int family,
                     int style,
@@ -137,6 +143,12 @@ bool wxFont::Create(int pointSize,
     return TRUE;
 }
 
+bool wxFont::Create(const wxNativeFontInfo& info)
+{
+    return Create(info.pointSize, info.family, info.style, info.weight,
+                  info.underlined, info.faceName, info.encoding);
+}
+
 wxFont::~wxFont()
 {
     if (wxTheFontList)
index f296efd93cb19bb41fc9923e166e7fbb6f7161f8..99cd68441ad9de7641580d276309485476ad105b 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "wx/fontenum.h"
 #include "wx/fontmap.h"
+#include "wx/fontutil.h"
 
 // ----------------------------------------------------------------------------
 // private classes