X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c91830cb4b924451c1ccd8835d64bd71f8e1df54..f925e7b4f3d017b33749bd23a64592c1985e8f98:/src/common/fmapbase.cpp diff --git a/src/common/fmapbase.cpp b/src/common/fmapbase.cpp index e9b303613c..8aba4bafc8 100644 --- a/src/common/fmapbase.cpp +++ b/src/common/fmapbase.cpp @@ -72,6 +72,7 @@ static wxFontEncoding gs_encodings[] = wxFONTENCODING_ISO8859_14, wxFONTENCODING_ISO8859_15, wxFONTENCODING_KOI8, + wxFONTENCODING_KOI8_U, wxFONTENCODING_CP932, wxFONTENCODING_CP936, wxFONTENCODING_CP949, @@ -115,6 +116,7 @@ static const wxChar* gs_encodingDescs[] = wxTRANSLATE( "Celtic (ISO-8859-14)" ), wxTRANSLATE( "Western European with Euro (ISO-8859-15)" ), wxTRANSLATE( "KOI8-R" ), + wxTRANSLATE( "KOI8-U" ), wxTRANSLATE( "Windows Japanese (CP 932)" ), wxTRANSLATE( "Windows Chinese Simplified (CP 936)" ), wxTRANSLATE( "Windows Korean (CP 949)" ), @@ -158,6 +160,7 @@ static const wxChar* gs_encodingNames[] = wxT( "iso-8859-14" ), wxT( "iso-8859-15" ), wxT( "koi8-r" ), + wxT( "koi8-u" ), wxT( "windows-932" ), wxT( "windows-936" ), wxT( "windows-949" ), @@ -517,14 +520,17 @@ wxFontMapperBase::NonInteractiveCharsetToEncoding(const wxString& charset) encoding = wxFONTENCODING_EUC_JP; } else if ( cs == wxT("KOI8-R") || - cs == wxT("KOI8-U") || cs == wxT("KOI8-RU") ) { // although koi8-ru is not strictly speaking the same as koi8-r, // they are similar enough to make mapping it to koi8 better than - // not reckognizing it at all + // not recognizing it at all encoding = wxFONTENCODING_KOI8; } + else if ( cs == wxT("KOI8-U") ) + { + encoding = wxFONTENCODING_KOI8_U; + } else if ( cs.Left(3) == wxT("ISO") ) { // the dash is optional (or, to be exact, it is not, but @@ -700,5 +706,26 @@ wxString wxFontMapperBase::GetEncodingName(wxFontEncoding encoding) return str; } +/* static */ +wxFontEncoding wxFontMapperBase::GetEncodingFromName(const wxString& name) +{ + const size_t count = WXSIZEOF(gs_encodingNames); + + for ( size_t i = 0; i < count; i++ ) + { + if ( gs_encodingNames[i] == name ) + { + return gs_encodings[i]; + } + } + + if ( name == _("default") ) + { + return wxFONTENCODING_DEFAULT; + } + + return wxFONTENCODING_MAX; +} + #endif // wxUSE_FONTMAP