]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/classic/fontutil.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: msw/fontutil.cpp
3 // Purpose: font-related helper functions for wxMSW
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
28 #include "wx/string.h"
33 #include "wx/fontutil.h"
34 #include "wx/fontmap.h"
35 #include "wx/encinfo.h"
37 #include "wx/tokenzr.h"
39 // ============================================================================
41 // ============================================================================
43 // ----------------------------------------------------------------------------
44 // wxNativeEncodingInfo
45 // ----------------------------------------------------------------------------
47 // convert to/from the string representation: format is
50 bool wxNativeEncodingInfo::FromString(const wxString
& s
)
52 wxStringTokenizer
tokenizer(s
, _T(";"));
54 facename
= tokenizer
.GetNextToken();
58 wxString tmp
= tokenizer
.GetNextToken();
61 // default charset (don't use DEFAULT_CHARSET though because of subtle
62 // Windows 9x/NT differences in handling it)
67 if ( wxSscanf(tmp
, _T("%u"), &charset
) != 1 )
69 // should be a number!
77 wxString
wxNativeEncodingInfo::ToString() const
82 s
<< _T(';') << charset
;
88 // ----------------------------------------------------------------------------
90 // ----------------------------------------------------------------------------
92 bool wxGetNativeFontEncoding(wxFontEncoding encoding
,
93 wxNativeEncodingInfo
*info
)
95 wxCHECK_MSG( info
, FALSE
, _T("bad pointer in wxGetNativeFontEncoding") );
97 if ( encoding
== wxFONTENCODING_DEFAULT
)
99 encoding
= wxFont::GetDefaultEncoding();
102 info
->encoding
= encoding
;
107 bool wxTestFontEncoding(const wxNativeEncodingInfo
& info
)
109 // basically we should be able to support every encoding via the OS