X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e2478fde622a16d25c66690af353dfdc37e7b582..e3b8a866960ec59e5c1dfa927e3e222b73ea8a57:/src/common/fmapbase.cpp diff --git a/src/common/fmapbase.cpp b/src/common/fmapbase.cpp index 7d6cb2f11e..b49754d7f9 100644 --- a/src/common/fmapbase.cpp +++ b/src/common/fmapbase.cpp @@ -32,13 +32,19 @@ #include "wx/intl.h" #endif //WX_PRECOMP +#if defined(__WXMSW__) + #include "wx/msw/private.h" // includes windows.h for LOGFONT + #include "wx/msw/winundef.h" +#endif + #include "wx/fontmap.h" #include "wx/fmappriv.h" #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 @@ -192,7 +198,7 @@ wxFontMapper *wxFontMapperBase::sm_instance = NULL; wxFontMapperBase::wxFontMapperBase() { -#if wxUSE_CONFIG +#if wxUSE_CONFIG && wxUSE_FILECONFIG m_config = NULL; m_configIsDummy = FALSE; #endif // wxUSE_CONFIG @@ -200,7 +206,7 @@ wxFontMapperBase::wxFontMapperBase() wxFontMapperBase::~wxFontMapperBase() { -#if wxUSE_CONFIG +#if wxUSE_CONFIG && wxUSE_FILECONFIG if ( m_configIsDummy ) delete m_config; #endif // wxUSE_CONFIG @@ -239,7 +245,7 @@ wxFontMapper *wxFontMapperBase::Set(wxFontMapper *mapper) return old; } -#if wxUSE_CONFIG +#if wxUSE_CONFIG && wxUSE_FILECONFIG // ---------------------------------------------------------------------------- // config usage customisation @@ -347,6 +353,8 @@ void wxFontMapperBase::RestorePath(const wxString& pathOld) GetConfig()->SetPath(pathOld); } +#endif + // ---------------------------------------------------------------------------- // charset/encoding correspondence // ---------------------------------------------------------------------------- @@ -354,13 +362,27 @@ 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; // 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() ) @@ -374,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 ) @@ -636,7 +658,5 @@ wxString wxFontMapperBase::GetEncodingName(wxFontEncoding encoding) return str; } -#endif // wxUSE_CONFIG - #endif // wxUSE_FONTMAP