]>
git.saurik.com Git - wxWidgets.git/blob - 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
8 // Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
19 #include "wx/string.h"
20 #include "wx/wxcrtvararg.h"
25 #include "wx/fontutil.h"
26 #include "wx/fontmap.h"
27 #include "wx/encinfo.h"
28 #include "wx/tokenzr.h"
31 // convert to/from the string representation:
32 // format is facename[;charset]
34 bool wxNativeEncodingInfo::FromString( const wxString
& s
)
36 wxStringTokenizer
tokenizer(s
, wxT(";"));
38 facename
= tokenizer
.GetNextToken();
42 wxString tmp
= tokenizer
.GetNextToken();
45 // default charset (don't use DEFAULT_CHARSET though because of subtle
46 // Windows 9x/NT differences in handling it)
51 if ( wxSscanf( tmp
, wxT("%u"), &charset
) != 1 )
52 // should be a number!
59 wxString
wxNativeEncodingInfo::ToString() const
63 s
<< wxT(';') << charset
;
68 // ----------------------------------------------------------------------------
70 // ----------------------------------------------------------------------------
72 bool wxGetNativeFontEncoding( wxFontEncoding encoding
, wxNativeEncodingInfo
*info
)
74 wxCHECK_MSG( info
, false, wxT("bad pointer in wxGetNativeFontEncoding") );
76 if ( encoding
== wxFONTENCODING_DEFAULT
)
77 encoding
= wxFont::GetDefaultEncoding();
79 info
->encoding
= encoding
;
84 bool wxTestFontEncoding( const wxNativeEncodingInfo
& WXUNUSED(info
) )
86 // basically we should be able to support every encoding via the OS