]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/fmapbase.cpp
borland fix
[wxWidgets.git] / src / common / fmapbase.cpp
index 83e91e70161ed271d2f13acbce03ee66c8c8130a..b49754d7f93f4faf22fe601869ad3d99b8019cab 100644 (file)
@@ -353,6 +353,8 @@ void wxFontMapperBase::RestorePath(const wxString& pathOld)
     GetConfig()->SetPath(pathOld);
 }
 
+#endif
+
 // ----------------------------------------------------------------------------
 // charset/encoding correspondence
 // ----------------------------------------------------------------------------
@@ -360,6 +362,20 @@ void wxFontMapperBase::RestorePath(const wxString& pathOld)
 wxFontEncoding
 wxFontMapperBase::CharsetToEncoding(const wxString& charset,
                                     bool WXUNUSED(interactive))
+{
+    int enc = NonInteractiveCharsetToEncoding(charset);
+    if ( enc == wxFONTENCODING_UNKNOWN )
+    {
+        // we should return wxFONTENCODING_SYSTEM from here for unknown
+        // encodings
+        enc = wxFONTENCODING_SYSTEM;
+    }
+
+    return (wxFontEncoding)enc;
+}
+
+int
+wxFontMapperBase::NonInteractiveCharsetToEncoding(const wxString& charset)
 {
     wxFontEncoding encoding = wxFONTENCODING_SYSTEM;
 
@@ -380,7 +396,7 @@ wxFontMapperBase::CharsetToEncoding(const wxString& charset,
             if ( value == wxFONTENCODING_UNKNOWN )
             {
                 // don't try to find it, in particular don't ask the user
-                return wxFONTENCODING_SYSTEM;
+                return value;
             }
 
             if ( value >= 0 && value <= wxFONTENCODING_MAX )
@@ -642,7 +658,5 @@ wxString wxFontMapperBase::GetEncodingName(wxFontEncoding encoding)
     return str;
 }
 
-#endif // wxUSE_CONFIG
-
 #endif // wxUSE_FONTMAP