#include "wx/apptrait.h"
#include "wx/module.h"
-#if wxUSE_CONFIG
+// wxMemoryConfig uses wxFileConfig
+#if wxUSE_CONFIG && wxUSE_FILECONFIG
#include "wx/config.h"
#include "wx/memconf.h"
#endif
wxFontMapperBase::wxFontMapperBase()
{
-#if wxUSE_CONFIG
+#if wxUSE_CONFIG && wxUSE_FILECONFIG
m_config = NULL;
m_configIsDummy = FALSE;
#endif // wxUSE_CONFIG
wxFontMapperBase::~wxFontMapperBase()
{
-#if wxUSE_CONFIG
+#if wxUSE_CONFIG && wxUSE_FILECONFIG
if ( m_configIsDummy )
delete m_config;
#endif // wxUSE_CONFIG
return old;
}
-#if wxUSE_CONFIG
+#if wxUSE_CONFIG && wxUSE_FILECONFIG
// ----------------------------------------------------------------------------
// config usage customisation
GetConfig()->SetPath(pathOld);
}
+#endif
+
// ----------------------------------------------------------------------------
// charset/encoding correspondence
// ----------------------------------------------------------------------------
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;
// we're going to modify it, make a copy
wxString cs = charset;
-#if wxUSE_CONFIG
+#if wxUSE_CONFIG && wxUSE_FILECONFIG
// first try the user-defined settings
wxFontMapperPathChanger path(this, FONTMAPPER_CHARSET_PATH);
if ( path.IsOk() )
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 )
return str;
}
-#endif // wxUSE_CONFIG
-
#endif // wxUSE_FONTMAP