]> git.saurik.com Git - wxWidgets.git/blob - src/osx/fontutil.cpp
Define __VISUALC__ for ICC under Windows again.
[wxWidgets.git] / src / osx / fontutil.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/fontutil.cpp
3 // Purpose: font-related helper functions for OS X
4 // Author: Vadim Zeitlin, Stefan Csomor
5 // Modified by:
6 // Created: 05.11.99
7 // Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 #include "wx/wxprec.h"
12
13 #ifdef __BORLANDC__
14 #pragma hdrstop
15 #endif
16
17 #ifndef WX_PRECOMP
18 #include "wx/string.h"
19 #include "wx/wxcrtvararg.h"
20 #include "wx/log.h"
21 #include "wx/intl.h"
22 #endif
23
24 #include "wx/fontutil.h"
25 #include "wx/fontmap.h"
26 #include "wx/encinfo.h"
27 #include "wx/tokenzr.h"
28
29
30 // convert to/from the string representation:
31 // format is facename[;charset]
32 //
33 bool wxNativeEncodingInfo::FromString( const wxString& s )
34 {
35 wxStringTokenizer tokenizer(s, wxT(";"));
36
37 facename = tokenizer.GetNextToken();
38 if ( !facename )
39 return false;
40
41 wxString tmp = tokenizer.GetNextToken();
42 if ( !tmp )
43 {
44 // default charset (don't use DEFAULT_CHARSET though because of subtle
45 // Windows 9x/NT differences in handling it)
46 charset = 0;
47 }
48 else
49 {
50 if ( wxSscanf( tmp, wxT("%u"), &charset ) != 1 )
51 // should be a number!
52 return false;
53 }
54
55 return true;
56 }
57
58 wxString wxNativeEncodingInfo::ToString() const
59 {
60 wxString s(facename);
61 if ( charset != 0 )
62 s << wxT(';') << charset;
63
64 return s;
65 }
66
67 // ----------------------------------------------------------------------------
68 // helper functions
69 // ----------------------------------------------------------------------------
70
71 bool wxGetNativeFontEncoding( wxFontEncoding encoding, wxNativeEncodingInfo *info )
72 {
73 wxCHECK_MSG( info, false, wxT("bad pointer in wxGetNativeFontEncoding") );
74
75 if ( encoding == wxFONTENCODING_DEFAULT )
76 encoding = wxFont::GetDefaultEncoding();
77
78 info->encoding = encoding;
79
80 return true;
81 }
82
83 bool wxTestFontEncoding( const wxNativeEncodingInfo& WXUNUSED(info) )
84 {
85 // basically we should be able to support every encoding via the OS
86 return true;
87 }