]> git.saurik.com Git - wxWidgets.git/blobdiff - src/unix/fontenum.cpp
Add code for parsing globs file in /usr/local as well
[wxWidgets.git] / src / unix / fontenum.cpp
index 25ab0816321a08f08ea37139b7393a56fb007af9..b7a026e5b6ce71837f808a776574808586fa1b92 100644 (file)
@@ -20,6 +20,8 @@
 // for compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
+#if wxUSE_FONTENUM
+
 #include "wx/fontenum.h"
 
 #ifndef WX_PRECOMP
@@ -66,77 +68,36 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
         return false;
     }
 
-#if defined(__WXGTK20__) || !defined(HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE)
-    if ( fixedWidthOnly
-#if defined(__WXGTK24__)
-        && (gtk_check_version(2,4,0) != NULL)
-#endif
-       )
-    {
-        OnFacename( wxT("monospace") );
-    }
-    else // !fixedWidthOnly
-#endif // __WXGTK20__ || !HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE
-    {
-        PangoFontFamily **families = NULL;
-        gint n_families = 0;
-        pango_context_list_families (
+    PangoFontFamily **families = NULL;
+    gint n_families = 0;
+    pango_context_list_families (
 #ifdef __WXGTK20__
-            gtk_widget_get_pango_context( wxGetRootWindow() ),
+        gtk_widget_get_pango_context( wxGetRootWindow() ),
 #else
-            wxTheApp->GetPangoContext(),
+        wxTheApp->GetPangoContext(),
 #endif
-            &families, &n_families );
-        qsort (families, n_families, sizeof (PangoFontFamily *), wxCompareFamilies);
+        &families, &n_families );
+    qsort (families, n_families, sizeof (PangoFontFamily *), wxCompareFamilies);
 
-        for (int i=0; i<n_families; i++)
-        {
-#if defined(__WXGTK24__) || defined(HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE)
-            if (!fixedWidthOnly || (
-#ifdef __WXGTK24__
-                !gtk_check_version(2,4,0) &&
-#endif
-                pango_font_family_is_monospace(families[i])
-                                   ) )
+    for ( int i = 0; i < n_families; i++ )
+    {
+#if defined(__WXGTK20__) || defined(HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE)
+        if ( !fixedWidthOnly ||
+            pango_font_family_is_monospace(families[i]) )
 #endif
-            {
-                const gchar *name = pango_font_family_get_name(families[i]);
-                OnFacename(wxString(name, wxConvUTF8));
-            }
+        {
+            const gchar *name = pango_font_family_get_name(families[i]);
+            OnFacename(wxString(name, wxConvUTF8));
         }
-        g_free(families);
     }
+    g_free(families);
 
     return true;
 }
 
 bool wxFontEnumerator::EnumerateEncodings(const wxString& facename)
 {
-    // name of UTF-8 encoding: no need to use wxFontMapper for it as it's
-    // unlikely to change
-    const wxString utf8(_T("UTF-8"));
-
-
-    // all fonts are in UTF-8 only when using Pango
-    if ( !facename.empty() )
-    {
-        OnFontEncoding(facename, utf8);
-        return true;
-    }
-
-    // so enumerating all facenames supporting this encoding is the same as
-    // enumerating all facenames
-    const wxArrayString facenames(GetFacenames(wxFONTENCODING_UTF8));
-    const size_t count = facenames.size();
-    if ( !count )
-        return false;
-
-    for ( size_t n = 0; n < count; n++ )
-    {
-        OnFontEncoding(facenames[n], utf8);
-    }
-
-    return true;
+    return EnumerateEncodingsUTF8(facename);
 }
 
 
@@ -384,3 +345,5 @@ bool wxFontEnumerator::EnumerateEncodings(const wxString& family)
 }
 
 #endif // !wxUSE_PANGO
+
+#endif // wxUSE_FONTENUM