X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1e1d0be19102670c4ea8c08ec5b9fd9467dcf02c..a201463482dc4417592ee014ff1a9706e8971dd6:/src/mac/carbon/fontutil.cpp diff --git a/src/mac/carbon/fontutil.cpp b/src/mac/carbon/fontutil.cpp index c5a0f583d6..0cc43c8953 100644 --- a/src/mac/carbon/fontutil.cpp +++ b/src/mac/carbon/fontutil.cpp @@ -6,22 +6,9 @@ // Created: 05.11.99 // RCS-ID: $Id$ // Copyright: (c) 1999 Vadim Zeitlin -// Licence: wxWindows license +// Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#ifdef __GNUG__ - #pragma implementation "fontutil.h" -#endif - -// For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ @@ -30,39 +17,27 @@ #ifndef WX_PRECOMP #include "wx/string.h" + #include "wx/wxcrtvararg.h" #include "wx/log.h" #include "wx/intl.h" -#endif //WX_PRECOMP +#endif #include "wx/fontutil.h" #include "wx/fontmap.h" - +#include "wx/encinfo.h" #include "wx/tokenzr.h" -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxNativeEncodingInfo -// ---------------------------------------------------------------------------- -// convert to/from the string representation: format is -// encodingid;facename[;charset] - -bool wxNativeEncodingInfo::FromString(const wxString& s) +// convert to/from the string representation: +// format is 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; + wxStringTokenizer tokenizer(s, wxT(";")); facename = tokenizer.GetNextToken(); if ( !facename ) - return FALSE; + return false; wxString tmp = tokenizer.GetNextToken(); if ( !tmp ) @@ -73,26 +48,19 @@ bool wxNativeEncodingInfo::FromString(const wxString& s) } else { - if ( wxSscanf(tmp, _T("%u"), &charset) != 1 ) - { + if ( wxSscanf( tmp, wxT("%u"), &charset ) != 1 ) // should be a number! - return FALSE; - } + return false; } - return TRUE; + return true; } wxString wxNativeEncodingInfo::ToString() const { - wxString s; - - s << (long)encoding << _T(';') << facename; - + wxString s(facename); if ( charset != 0 ) - { - s << _T(';') << charset; - } + s << wxT(';') << charset; return s; } @@ -101,70 +69,20 @@ wxString wxNativeEncodingInfo::ToString() const // helper functions // ---------------------------------------------------------------------------- -bool wxGetNativeFontEncoding(wxFontEncoding encoding, - wxNativeEncodingInfo *info) +bool wxGetNativeFontEncoding( wxFontEncoding encoding, wxNativeEncodingInfo *info ) { - wxCHECK_MSG( info, FALSE, _T("bad pointer in wxGetNativeFontEncoding") ); + wxCHECK_MSG( info, false, wxT("bad pointer in wxGetNativeFontEncoding") ); if ( encoding == wxFONTENCODING_DEFAULT ) - { 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; - return TRUE; + return true; } -bool wxTestFontEncoding(const wxNativeEncodingInfo& info) +bool wxTestFontEncoding( const wxNativeEncodingInfo& info ) { - return TRUE; + // basically we should be able to support every encoding via the OS + return true; }