]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/fmapbase.cpp
byte ordering changed to network ordering
[wxWidgets.git] / src / common / fmapbase.cpp
index e9b303613cdf74b7cc64aa1025a05e75a4c25324..8aba4bafc8b43ec6482fd7605ec389ffadb167df 100644 (file)
@@ -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