]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/fontutil.cpp
switching from native rtti to wxrtti
[wxWidgets.git] / src / mac / carbon / fontutil.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: msw/fontutil.cpp
3 // Purpose: font-related helper functions for wxMSW
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 05.11.99
7 // RCS-ID: $Id$
8 // Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/wxprec.h"
13
14 #ifdef __BORLANDC__
15 #pragma hdrstop
16 #endif
17
18 #ifndef WX_PRECOMP
19 #include "wx/string.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& info )
84 {
85 // basically we should be able to support every encoding via the OS
86 return true;
87 }