]> git.saurik.com Git - wxWidgets.git/blobdiff - src/unix/fontenum.cpp
Applied patch [ 1701723 ] wxAUI: Added event for doubleclicks on the tabbar bg
[wxWidgets.git] / src / unix / fontenum.cpp
index 0496afeeef74d1e2ec1ecc971a8203622759d4be..dc50c9b740091a1153f172abab94a8dff04363d3 100644 (file)
 // for compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
 // for compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
-#include "wx/dynarray.h"
-#include "wx/string.h"
+#if wxUSE_FONTENUM
+
+#include "wx/fontenum.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/dynarray.h"
+    #include "wx/string.h"
+    #include "wx/app.h"
+    #include "wx/utils.h"
+#endif
+
 #include "wx/regex.h"
 #include "wx/regex.h"
-#include "wx/utils.h"
-#include "wx/app.h"
 #include "wx/fontmap.h"
 #include "wx/fontmap.h"
-#include "wx/fontenum.h"
 #include "wx/fontutil.h"
 #include "wx/encinfo.h"
 
 #include "wx/fontutil.h"
 #include "wx/encinfo.h"
 
@@ -52,20 +58,26 @@ wxCompareFamilies (const void *a, const void *b)
   return g_utf8_collate (a_name, b_name);
 }
 
   return g_utf8_collate (a_name, b_name);
 }
 
-// I admit I don't yet understand encodings with Pango
 bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
                                           bool fixedWidthOnly)
 {
 bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
                                           bool fixedWidthOnly)
 {
+    if ( encoding != wxFONTENCODING_SYSTEM && encoding != wxFONTENCODING_UTF8 )
+    {
+        // Pango supports only UTF-8 encoding (and system means any, so we
+        // accept it too)
+        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
        )
 #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") );
     }
         OnFacename( wxT("monospace") );
     }
-    else
+    else // !fixedWidthOnly
 #endif // __WXGTK20__ || !HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE
     {
         PangoFontFamily **families = NULL;
 #endif // __WXGTK20__ || !HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE
     {
         PangoFontFamily **families = NULL;
@@ -100,14 +112,13 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
     return true;
 }
 
     return true;
 }
 
-bool wxFontEnumerator::EnumerateEncodings(const wxString& family)
+bool wxFontEnumerator::EnumerateEncodings(const wxString& facename)
 {
 {
-    return false;
+    return EnumerateEncodingsUTF8(facename);
 }
 
 
 }
 
 
-#else
-  // Pango
+#else // !wxUSE_PANGO
 
 #ifdef __VMS__ // Xlib.h for VMS is not (yet) compatible with C++
                // The resulting warnings are switched off here
 
 #ifdef __VMS__ // Xlib.h for VMS is not (yet) compatible with C++
                // The resulting warnings are switched off here
@@ -194,6 +205,7 @@ static bool ProcessFamiliesFromFontList(wxFontEnumerator *This,
             continue;
         }
 
             continue;
         }
 
+        // coverity[returned_null]
         char *dash = strchr(font + 1, '-');
         char *family = dash + 1;
         dash = strchr(family, '-');
         char *dash = strchr(font + 1, '-');
         char *family = dash + 1;
         dash = strchr(family, '-');
@@ -350,3 +362,5 @@ bool wxFontEnumerator::EnumerateEncodings(const wxString& family)
 }
 
 #endif // !wxUSE_PANGO
 }
 
 #endif // !wxUSE_PANGO
+
+#endif // wxUSE_FONTENUM