]> git.saurik.com Git - wxWidgets.git/blobdiff - src/unix/fontutil.cpp
Fix for incomplete setup (wxPalmOS case).
[wxWidgets.git] / src / unix / fontutil.cpp
index 79f36b31dda4c5d712a2f463931073eee97ceb30..6599fa5e7114c93a99558c86b777d2a4ae01a0b3 100644 (file)
@@ -57,15 +57,16 @@ void wxNativeFontInfo::Init()
     description = NULL;
 }
 
-wxNativeFontInfo::wxNativeFontInfo(const wxNativeFontInfo& info)
+void
+wxNativeFontInfo::Init(const wxNativeFontInfo& info)
 {
     if (info.description)
         description = pango_font_description_copy(info.description);
     else
-        description = NULL;            
+        description = NULL;
 }
 
-wxNativeFontInfo::~wxNativeFontInfo()
+void wxNativeFontInfo::Free()
 {
     if (description)
         pango_font_description_free(description);
@@ -236,7 +237,17 @@ bool wxTestFontEncoding(const wxNativeEncodingInfo& info)
 bool wxGetNativeFontEncoding(wxFontEncoding encoding,
                              wxNativeEncodingInfo *info)
 {
-    return FALSE;
+    // 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();
+        info->encoding = wxFONTENCODING_SYSTEM;
+    }
+
+    // pretend that we support everything, it's better than to always return
+    // false as the old code did
+    return true;
 }
 
 #else // GTK+ 1.x
@@ -724,7 +735,7 @@ bool wxGetNativeFontEncoding(wxFontEncoding encoding,
             break;
 
         case wxFONTENCODING_GB2312:
-            info->xregistry = wxT("GB2312");   // or the otherway round? 
+            info->xregistry = wxT("GB2312");   // or the otherway round?
             info->xencoding = wxT("*");
             break;