]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/fontutil.cpp
6318e4a807f52a1944b19c517aa75fd9d9f0b28f
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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "fontutil.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
32 #include "wx/string.h"
37 #include "wx/fontutil.h"
38 #include "wx/fontmap.h"
39 #include "wx/encinfo.h"
41 #include "wx/tokenzr.h"
43 // ============================================================================
45 // ============================================================================
47 // ----------------------------------------------------------------------------
48 // wxNativeEncodingInfo
49 // ----------------------------------------------------------------------------
51 // convert to/from the string representation: format is
54 bool wxNativeEncodingInfo::FromString(const wxString
& s
)
56 wxStringTokenizer
tokenizer(s
, _T(";"));
58 facename
= tokenizer
.GetNextToken();
62 wxString tmp
= tokenizer
.GetNextToken();
65 // default charset (don't use DEFAULT_CHARSET though because of subtle
66 // Windows 9x/NT differences in handling it)
71 if ( wxSscanf(tmp
, _T("%u"), &charset
) != 1 )
73 // should be a number!
81 wxString
wxNativeEncodingInfo::ToString() const
86 s
<< _T(';') << charset
;
92 // ----------------------------------------------------------------------------
94 // ----------------------------------------------------------------------------
96 bool wxGetNativeFontEncoding(wxFontEncoding encoding
,
97 wxNativeEncodingInfo
*info
)
99 wxCHECK_MSG( info
, FALSE
, _T("bad pointer in wxGetNativeFontEncoding") );
101 if ( encoding
== wxFONTENCODING_DEFAULT
)
103 encoding
= wxFont::GetDefaultEncoding();
106 info
->encoding
= encoding
;
111 bool wxTestFontEncoding(const wxNativeEncodingInfo
& info
)
113 // basically we should be able to support every encoding via the OS