]> git.saurik.com Git - wxWidgets.git/commitdiff
Highly experimental, unstable code (for determining the
authorRobert Roebling <robert@roebling.de>
Sun, 19 Mar 2000 10:31:26 +0000 (10:31 +0000)
committerRobert Roebling <robert@roebling.de>
Sun, 19 Mar 2000 10:31:26 +0000 (10:31 +0000)
    encoding of the default GUI font). #ifdeffed.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6845 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/font.cpp
src/gtk/settings.cpp
src/gtk1/font.cpp
src/gtk1/settings.cpp

index 02d61bff580b28bb29ae61ea54ee99fae35fa8ac..26a9ba0dcb61aa6f56d745fbe0ec1193448fe272 100644 (file)
@@ -31,6 +31,7 @@
 #include <strings.h>
 
 #include <gdk/gdk.h>
 #include <strings.h>
 
 #include <gdk/gdk.h>
+#include <gdk/gdkprivate.h>
 #include <gtk/gtk.h>
 
 // ----------------------------------------------------------------------------
 #include <gtk/gtk.h>
 
 // ----------------------------------------------------------------------------
@@ -190,8 +191,11 @@ wxFont::wxFont( const wxString& fontname, const wxFontData& fontdata )
     tn.GetNextToken();                           // pixel size
 
     tmp = tn.GetNextToken();                     // pointsize
     tn.GetNextToken();                           // pixel size
 
     tmp = tn.GetNextToken();                     // pointsize
-    long num = wxStrtol (tmp.c_str(), (wxChar **) NULL, 10);
-    M_FONTDATA->m_pointSize = (int)(num / 10);
+    if (tmp != wxT("*"))
+    {
+        long num = wxStrtol (tmp.c_str(), (wxChar **) NULL, 10);
+        M_FONTDATA->m_pointSize = (int)(num / 10);
+    }
 
     tn.GetNextToken();                           // x-res
     tn.GetNextToken();                           // y-res
 
     tn.GetNextToken();                           // x-res
     tn.GetNextToken();                           // y-res
index 658c74ab4e8d846ac4188c83d46a0e04bda29de7..4a491823fa31ccd8c1a23d1c755e8bd0f509425b 100644 (file)
 #include "wx/settings.h"
 #include "wx/debug.h"
 
 #include "wx/settings.h"
 #include "wx/debug.h"
 
+#include "wx/cmndata.h"
+
 #include <gdk/gdk.h>
 #include <gdk/gdk.h>
+#include <gdk/gdkprivate.h>
 #include <gtk/gtk.h>
 
 #include <gtk/gtk.h>
 
+
 /*
 #define wxSYS_COLOUR_SCROLLBAR         0
 #define wxSYS_COLOUR_BACKGROUND        1
 /*
 #define wxSYS_COLOUR_SCROLLBAR         0
 #define wxSYS_COLOUR_BACKGROUND        1
@@ -228,7 +232,35 @@ wxFont wxSystemSettings::GetSystemFont( int index )
         case wxSYS_DEFAULT_GUI_FONT:
         {
             if (!g_systemFont)
         case wxSYS_DEFAULT_GUI_FONT:
         {
             if (!g_systemFont)
-                g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL );
+            {
+                GdkFont *gdk_font = (GdkFont*) NULL;
+                GtkWidget *widget = gtk_button_new();
+#if 0
+                GtkStyle *def = gtk_rc_get_style( widget );
+                if (def)
+                    gdk_font =  def->font;
+                else
+                {
+                    def = gtk_widget_get_default_style();
+                    if (def)
+                        gdk_font =  def->font;
+                }
+#endif
+                if (gdk_font)
+                {
+                    GSList *font_list = ((GdkFontPrivate*)gdk_font)->names;
+                    char *name = (char*)font_list->data;
+                    wxString font_string( name );
+                    wxFontData font_data;
+                    g_systemFont = new wxFont( font_string, font_data );
+                }
+                else
+                {
+                    g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL );
+                }
+                
+                gtk_widget_destroy( widget );
+            }
             return *g_systemFont;
         }
     }
             return *g_systemFont;
         }
     }
index 02d61bff580b28bb29ae61ea54ee99fae35fa8ac..26a9ba0dcb61aa6f56d745fbe0ec1193448fe272 100644 (file)
@@ -31,6 +31,7 @@
 #include <strings.h>
 
 #include <gdk/gdk.h>
 #include <strings.h>
 
 #include <gdk/gdk.h>
+#include <gdk/gdkprivate.h>
 #include <gtk/gtk.h>
 
 // ----------------------------------------------------------------------------
 #include <gtk/gtk.h>
 
 // ----------------------------------------------------------------------------
@@ -190,8 +191,11 @@ wxFont::wxFont( const wxString& fontname, const wxFontData& fontdata )
     tn.GetNextToken();                           // pixel size
 
     tmp = tn.GetNextToken();                     // pointsize
     tn.GetNextToken();                           // pixel size
 
     tmp = tn.GetNextToken();                     // pointsize
-    long num = wxStrtol (tmp.c_str(), (wxChar **) NULL, 10);
-    M_FONTDATA->m_pointSize = (int)(num / 10);
+    if (tmp != wxT("*"))
+    {
+        long num = wxStrtol (tmp.c_str(), (wxChar **) NULL, 10);
+        M_FONTDATA->m_pointSize = (int)(num / 10);
+    }
 
     tn.GetNextToken();                           // x-res
     tn.GetNextToken();                           // y-res
 
     tn.GetNextToken();                           // x-res
     tn.GetNextToken();                           // y-res
index 658c74ab4e8d846ac4188c83d46a0e04bda29de7..4a491823fa31ccd8c1a23d1c755e8bd0f509425b 100644 (file)
 #include "wx/settings.h"
 #include "wx/debug.h"
 
 #include "wx/settings.h"
 #include "wx/debug.h"
 
+#include "wx/cmndata.h"
+
 #include <gdk/gdk.h>
 #include <gdk/gdk.h>
+#include <gdk/gdkprivate.h>
 #include <gtk/gtk.h>
 
 #include <gtk/gtk.h>
 
+
 /*
 #define wxSYS_COLOUR_SCROLLBAR         0
 #define wxSYS_COLOUR_BACKGROUND        1
 /*
 #define wxSYS_COLOUR_SCROLLBAR         0
 #define wxSYS_COLOUR_BACKGROUND        1
@@ -228,7 +232,35 @@ wxFont wxSystemSettings::GetSystemFont( int index )
         case wxSYS_DEFAULT_GUI_FONT:
         {
             if (!g_systemFont)
         case wxSYS_DEFAULT_GUI_FONT:
         {
             if (!g_systemFont)
-                g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL );
+            {
+                GdkFont *gdk_font = (GdkFont*) NULL;
+                GtkWidget *widget = gtk_button_new();
+#if 0
+                GtkStyle *def = gtk_rc_get_style( widget );
+                if (def)
+                    gdk_font =  def->font;
+                else
+                {
+                    def = gtk_widget_get_default_style();
+                    if (def)
+                        gdk_font =  def->font;
+                }
+#endif
+                if (gdk_font)
+                {
+                    GSList *font_list = ((GdkFontPrivate*)gdk_font)->names;
+                    char *name = (char*)font_list->data;
+                    wxString font_string( name );
+                    wxFontData font_data;
+                    g_systemFont = new wxFont( font_string, font_data );
+                }
+                else
+                {
+                    g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL );
+                }
+                
+                gtk_widget_destroy( widget );
+            }
             return *g_systemFont;
         }
     }
             return *g_systemFont;
         }
     }