#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
wxFONTENCODING_CP437,
wxFONTENCODING_UTF7,
wxFONTENCODING_UTF8,
+ wxFONTENCODING_UTF16,
+ wxFONTENCODING_UTF16BE,
+ wxFONTENCODING_UTF16LE,
+ wxFONTENCODING_UTF32,
+ wxFONTENCODING_UTF32BE,
+ wxFONTENCODING_UTF32LE,
wxFONTENCODING_EUC_JP,
};
wxTRANSLATE( "Windows/DOS OEM (CP 437)" ),
wxTRANSLATE( "Unicode 7 bit (UTF-7)" ),
wxTRANSLATE( "Unicode 8 bit (UTF-8)" ),
+ wxTRANSLATE( "Unicode 16 bit (UTF-16)" ),
+ wxTRANSLATE( "Unicode 16 bit Big Endian (UTF-16BE)" ),
+ wxTRANSLATE( "Unicode 16 bit Little Endian (UTF-16LE)" ),
+ wxTRANSLATE( "Unicode 32 bit (UTF-32)" ),
+ wxTRANSLATE( "Unicode 32 bit Big Endian (UTF-32BE)" ),
+ wxTRANSLATE( "Unicode 32 bit Little Endian (UTF-32LE)" ),
wxTRANSLATE( "Extended Unix Codepage for Japanese (EUC-JP)" ),
};
wxT( "windows-437" ),
wxT( "utf-7" ),
wxT( "utf-8" ),
+ wxT( "utf-16" ),
+ wxT( "utf-16be" ),
+ wxT( "utf-16le" ),
+ wxT( "utf-32" ),
+ wxT( "utf-32be" ),
+ wxT( "utf-32le" ),
wxT( "euc-jp" ),
};
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 )
{
encoding = wxFONTENCODING_UTF8;
}
+ else if ( cs == wxT("UTF-16") )
+ {
+ encoding = wxFONTENCODING_UTF16;
+ }
+ else if ( cs == wxT("UTF-16BE") )
+ {
+ encoding = wxFONTENCODING_UTF16BE;
+ }
+ else if ( cs == wxT("UTF-16LE") )
+ {
+ encoding = wxFONTENCODING_UTF16LE;
+ }
+ else if ( cs == wxT("UTF-32") || cs == wxT("UCS-4") )
+ {
+ encoding = wxFONTENCODING_UTF32;
+ }
+ else if ( cs == wxT("UTF-32BE") || cs == wxT("UCS-4BE") )
+ {
+ encoding = wxFONTENCODING_UTF32BE;
+ }
+ else if ( cs == wxT("UTF-32LE") || cs == wxT("UCS-4LE") )
+ {
+ encoding = wxFONTENCODING_UTF32LE;
+ }
else if ( cs == wxT("GB2312") )
{
encoding = wxFONTENCODING_GB2312;
return str;
}
-#endif // wxUSE_CONFIG
-
#endif // wxUSE_FONTMAP