// Created: 05.11.99
// RCS-ID: $Id$
// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
-// Licence: wxWindows license
+// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// ============================================================================
#include "wx/fontutil.h"
#include "wx/fontmap.h"
+#include "wx/encinfo.h"
#include "wx/tokenzr.h"
// ----------------------------------------------------------------------------
// convert to/from the string representation: format is
-// encodingid;facename[;charset]
+// facename[;charset]
bool wxNativeEncodingInfo::FromString(const wxString& s)
{
wxStringTokenizer tokenizer(s, _T(";"));
- wxString encid = tokenizer.GetNextToken();
- long enc;
- if ( !encid.ToLong(&enc) )
- return FALSE;
- encoding = (wxFontEncoding)enc;
-
facename = tokenizer.GetNextToken();
if ( !facename )
return FALSE;
wxString wxNativeEncodingInfo::ToString() const
{
- wxString s;
-
- s << (long)encoding << _T(';') << facename;
-
+ wxString s(facename);
if ( charset != 0 )
{
s << _T(';') << charset;
encoding = wxFont::GetDefaultEncoding();
}
- switch ( encoding )
- {
- // although this function is supposed to return an exact match, do do
- // some mappings here for the most common case of "standard" encoding
- case wxFONTENCODING_SYSTEM:
- case wxFONTENCODING_ISO8859_1:
- case wxFONTENCODING_ISO8859_15:
- case wxFONTENCODING_CP1252:
- info->charset = 0;
- break;
-
- case wxFONTENCODING_CP1250:
- info->charset = 0;
- break;
-
- case wxFONTENCODING_CP1251:
- info->charset = 0;
- break;
-
- case wxFONTENCODING_CP1253:
- info->charset = 0;
- break;
-
- case wxFONTENCODING_CP1254:
- info->charset = 0;
- break;
-
- case wxFONTENCODING_CP1255:
- info->charset = 0;
- break;
-
- case wxFONTENCODING_CP1256:
- info->charset = 0;
- break;
-
- case wxFONTENCODING_CP1257:
- info->charset = 0;
- break;
-
- case wxFONTENCODING_CP437:
- info->charset = 0;
- break;
-
- default:
- // no way to translate this encoding into a Windows charset
- return FALSE;
- }
-
- info->encoding = encoding;
+ info->encoding = encoding ;
return TRUE;
}
bool wxTestFontEncoding(const wxNativeEncodingInfo& info)
{
- return TRUE;
+ return info.encoding == wxFont::GetDefaultEncoding() ;
}
+
+