]> git.saurik.com Git - wxWidgets.git/blobdiff - src/unix/fontutil.cpp
corrected typo in check for icc
[wxWidgets.git] / src / unix / fontutil.cpp
index 7b1801857e34c3e844e8a6e9ed31497842f634d4..cf77187acba91b7e494dbb1bcb7dd060b7e22727 100644 (file)
 // headers
 // ----------------------------------------------------------------------------
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-    #pragma implementation "fontutil.h"
-#endif
-
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
@@ -139,7 +135,11 @@ wxString wxNativeFontInfo::GetFaceName() const
 wxFontFamily wxNativeFontInfo::GetFamily() const
 {
     wxFontFamily ret = wxFONTFAMILY_DEFAULT;
-    char *family_text = g_ascii_strdown( pango_font_description_get_family( description ), -1 );
+    // note: not passing -1 as the 2nd parameter to g_ascii_strdown to work
+    // around a bug in the 64-bit glib shipped with solaris 10, -1 causes it
+    // to try to allocate 2^32 bytes.
+    const char *family_name = pango_font_description_get_family( description );
+    char *family_text = g_ascii_strdown( family_name, family_name ? strlen( family_name ) : 0 );
     // Check for some common fonts, to salvage what we can from the current win32 centric wxFont API:
     if (strncmp( family_text, "monospace", 9 ) == 0)
         ret = wxFONTFAMILY_TELETYPE; // begins with "Monospace"
@@ -173,7 +173,9 @@ wxFontFamily wxNativeFontInfo::GetFamily() const
 
         g_free(families);
 
-        wxASSERT_MSG( family, wxT("wxNativeFontInfo::GetFamily() - No appropriate PangoFontFamily found for ::description") );
+        // Some gtk+ systems might query for a non-existing font from wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)
+        // on initialization, don't assert until wxSystemSettings::GetFont is checked for this - MR
+        // wxASSERT_MSG( family, wxT("wxNativeFontInfo::GetFamily() - No appropriate PangoFontFamily found for ::description") );
 
         //BCI: Cache the wxFontFamily inside the class. Validate cache with
         //BCI: g_ascii_strcasecmp(pango_font_description_get_family(description), pango_font_family_get_name(family)) == 0
@@ -252,7 +254,7 @@ void wxNativeFontInfo::SetUnderlined(bool WXUNUSED(underlined))
     wxFAIL_MSG( _T("not implemented") );
 }
 
-void wxNativeFontInfo::SetFaceName(wxString facename)
+void wxNativeFontInfo::SetFaceName(const wxString& facename)
 {
     pango_font_description_set_family( description, wxGTK_CONV(facename) );
 }
@@ -751,7 +753,7 @@ void wxNativeFontInfo::SetUnderlined(bool WXUNUSED(underlined))
     // can't do this under X
 }
 
-void wxNativeFontInfo::SetFaceName(wxString facename)
+void wxNativeFontInfo::SetFaceName(const wxString& facename)
 {
     SetXFontComponent(wxXLFD_FAMILY, facename);
 }