]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed wxFontMapper behaviour under wxGTK2: it now just maps all encodings to UTF-8
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 12 Feb 2006 23:39:55 +0000 (23:39 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 12 Feb 2006 23:39:55 +0000 (23:39 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37542 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/fontmap.cpp
src/unix/fontutil.cpp

index 18114477ff855487927f5b91b8f5eb01fe53ad1d..dca08069106ec88cb2d909cd5a048b6ef3479561 100644 (file)
@@ -491,16 +491,23 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding,
                                      const wxString& facename,
                                      bool interactive)
 {
+    wxCHECK_MSG( encodingAlt, false,
+                    _T("wxFontEncoding::GetAltForEncoding(): NULL pointer") );
+
+#ifdef __WXGTK20__
+    // in GTK+ 2 we can always use UTF-8 for everything so just do it,
+    // especially as no other font encodings are currently supported
+    *encodingAlt = wxFONTENCODING_UTF8;
+    return true;
+#else // !wxGTK2
     wxNativeEncodingInfo info;
     if ( !GetAltForEncoding(encoding, &info, facename, interactive) )
         return false;
 
-    wxCHECK_MSG( encodingAlt, false,
-                    _T("wxFontEncoding::GetAltForEncoding(): NULL pointer") );
-
     *encodingAlt = info.encoding;
 
     return true;
+#endif // wxGTK2/!wxGTK2
 }
 
 bool wxFontMapper::IsEncodingAvailable(wxFontEncoding encoding,
index 84c7abec5d6f4c55661bcca7af629ba7714f0ce7..b1eda856d452f76e029b0552bbdfaaa435df3eef 100644 (file)
@@ -304,7 +304,7 @@ wxString wxNativeFontInfo::ToUserString() const
 // wxNativeEncodingInfo
 // ----------------------------------------------------------------------------
 
-bool wxNativeEncodingInfo::FromString(const wxString& s)
+bool wxNativeEncodingInfo::FromString(const wxString& WXUNUSED(s))
 {
     return false;
 }
@@ -314,7 +314,7 @@ wxString wxNativeEncodingInfo::ToString() const
     return wxEmptyString;
 }
 
-bool wxTestFontEncoding(const wxNativeEncodingInfo& info)
+bool wxTestFontEncoding(const wxNativeEncodingInfo& WXUNUSED(info))
 {
     return true;
 }
@@ -322,17 +322,25 @@ bool wxTestFontEncoding(const wxNativeEncodingInfo& info)
 bool wxGetNativeFontEncoding(wxFontEncoding encoding,
                              wxNativeEncodingInfo *info)
 {
-    // we *must* return true for default encoding as otherwise wxFontMapper
-    // considers that we can't load any font and aborts with wxLogFatalError!
-    if ( encoding == wxFONTENCODING_SYSTEM )
+    info->facename.clear();
+
+    switch ( encoding )
     {
-        info->facename.clear();
-        info->encoding = wxFONTENCODING_SYSTEM;
-    }
+        // we *must* return true for default encodings as otherwise wxFontMapper
+        // considers that we can't load any font and aborts with wxLogFatalError!
+        case wxFONTENCODING_DEFAULT:
+        case wxFONTENCODING_SYSTEM:
+            info->encoding = wxFONTENCODING_SYSTEM;
+            return true;
 
-    // pretend that we support everything, it's better than to always return
-    // false as the old code did
-    return true;
+        case wxFONTENCODING_UTF8:
+            info->encoding = wxFONTENCODING_UTF8;
+            return true;
+
+        default:
+            // everything else must be converted to UTF-8
+            return false;
+    }
 }
 
 #else // GTK+ 1.x