]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/fontutil.cpp
Fixed GetIcon to keep up with return type change on all other platforms.
[wxWidgets.git] / src / mac / carbon / fontutil.cpp
CommitLineData
72e7876b
SC
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>
65571936 9// Licence: wxWindows licence
72e7876b
SC
10///////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
72e7876b
SC
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"
050ffabb 35#include "wx/encinfo.h"
72e7876b
SC
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
2f1ae414 48// facename[;charset]
72e7876b
SC
49
50bool 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
77wxString wxNativeEncodingInfo::ToString() const
78{
2f1ae414 79 wxString s(facename);
72e7876b
SC
80 if ( charset != 0 )
81 {
82 s << _T(';') << charset;
83 }
84
85 return s;
86}
87
88// ----------------------------------------------------------------------------
89// helper functions
90// ----------------------------------------------------------------------------
91
92bool 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
25b1b566 102 info->encoding = encoding ;
72e7876b
SC
103
104 return TRUE;
105}
106
107bool wxTestFontEncoding(const wxNativeEncodingInfo& info)
108{
908d407c
SC
109 // basically we should be able to support every encoding via the OS
110 return true ;
72e7876b 111}
25b1b566 112
25b1b566 113