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