]>
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
7 // Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #include "wx/wxprec.h"
18 #include "wx/string.h"
19 #include "wx/wxcrtvararg.h"
24 #include "wx/fontutil.h"
25 #include "wx/fontmap.h"
26 #include "wx/encinfo.h"
27 #include "wx/tokenzr.h"
30 // convert to/from the string representation:
31 // format is facename[;charset]
33 bool wxNativeEncodingInfo::FromString( const wxString
& s
)
35 wxStringTokenizer
tokenizer(s
, wxT(";"));
37 facename
= tokenizer
.GetNextToken();
41 wxString tmp
= tokenizer
.GetNextToken();
44 // default charset (don't use DEFAULT_CHARSET though because of subtle
45 // Windows 9x/NT differences in handling it)
50 if ( wxSscanf( tmp
, wxT("%u"), &charset
) != 1 )
51 // should be a number!
58 wxString
wxNativeEncodingInfo::ToString() const
62 s
<< wxT(';') << charset
;
67 // ----------------------------------------------------------------------------
69 // ----------------------------------------------------------------------------
71 bool wxGetNativeFontEncoding( wxFontEncoding encoding
, wxNativeEncodingInfo
*info
)
73 wxCHECK_MSG( info
, false, wxT("bad pointer in wxGetNativeFontEncoding") );
75 if ( encoding
== wxFONTENCODING_DEFAULT
)
76 encoding
= wxFont::GetDefaultEncoding();
78 info
->encoding
= encoding
;
83 bool wxTestFontEncoding( const wxNativeEncodingInfo
& WXUNUSED(info
) )
85 // basically we should be able to support every encoding via the OS