]> git.saurik.com Git - wxWidgets.git/blob - src/mac/classic/fontutil.cpp
Override GetPixelSize on OS X as the base impl creates a wxScreenDC each time, which...
[wxWidgets.git] / src / mac / classic / 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 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
22
23 #ifdef __BORLANDC__
24 #pragma hdrstop
25 #endif
26
27 #ifndef WX_PRECOMP
28 #include "wx/string.h"
29 #include "wx/log.h"
30 #include "wx/intl.h"
31 #endif //WX_PRECOMP
32
33 #include "wx/fontutil.h"
34 #include "wx/fontmap.h"
35 #include "wx/encinfo.h"
36
37 #include "wx/tokenzr.h"
38
39 // ============================================================================
40 // implementation
41 // ============================================================================
42
43 // ----------------------------------------------------------------------------
44 // wxNativeEncodingInfo
45 // ----------------------------------------------------------------------------
46
47 // convert to/from the string representation: format is
48 // facename[;charset]
49
50 bool wxNativeEncodingInfo::FromString(const wxString& s)
51 {
52 wxStringTokenizer tokenizer(s, _T(";"));
53
54 facename = tokenizer.GetNextToken();
55 if ( !facename )
56 return FALSE;
57
58 wxString tmp = tokenizer.GetNextToken();
59 if ( !tmp )
60 {
61 // default charset (don't use DEFAULT_CHARSET though because of subtle
62 // Windows 9x/NT differences in handling it)
63 charset = 0;
64 }
65 else
66 {
67 if ( wxSscanf(tmp, _T("%u"), &charset) != 1 )
68 {
69 // should be a number!
70 return FALSE;
71 }
72 }
73
74 return TRUE;
75 }
76
77 wxString wxNativeEncodingInfo::ToString() const
78 {
79 wxString s(facename);
80 if ( charset != 0 )
81 {
82 s << _T(';') << charset;
83 }
84
85 return s;
86 }
87
88 // ----------------------------------------------------------------------------
89 // helper functions
90 // ----------------------------------------------------------------------------
91
92 bool wxGetNativeFontEncoding(wxFontEncoding encoding,
93 wxNativeEncodingInfo *info)
94 {
95 wxCHECK_MSG( info, FALSE, _T("bad pointer in wxGetNativeFontEncoding") );
96
97 if ( encoding == wxFONTENCODING_DEFAULT )
98 {
99 encoding = wxFont::GetDefaultEncoding();
100 }
101
102 info->encoding = encoding ;
103
104 return TRUE;
105 }
106
107 bool wxTestFontEncoding(const wxNativeEncodingInfo& info)
108 {
109 // basically we should be able to support every encoding via the OS
110 return true ;
111 }
112
113