]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/fontutil.cpp
document On{Open,Save}Document()
[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
72e7876b
SC
12#include "wx/wxprec.h"
13
14#ifdef __BORLANDC__
15 #pragma hdrstop
16#endif
17
18#ifndef WX_PRECOMP
19 #include "wx/string.h"
bfd67dca 20 #include "wx/wxcrtvararg.h"
72e7876b
SC
21 #include "wx/log.h"
22 #include "wx/intl.h"
f3078f07 23#endif
72e7876b
SC
24
25#include "wx/fontutil.h"
26#include "wx/fontmap.h"
050ffabb 27#include "wx/encinfo.h"
72e7876b
SC
28#include "wx/tokenzr.h"
29
72e7876b 30
f3078f07
DS
31// convert to/from the string representation:
32// format is facename[;charset]
33//
34bool wxNativeEncodingInfo::FromString( const wxString& s )
72e7876b 35{
f3078f07 36 wxStringTokenizer tokenizer(s, wxT(";"));
72e7876b
SC
37
38 facename = tokenizer.GetNextToken();
39 if ( !facename )
f3078f07 40 return false;
72e7876b
SC
41
42 wxString tmp = tokenizer.GetNextToken();
43 if ( !tmp )
44 {
45 // default charset (don't use DEFAULT_CHARSET though because of subtle
46 // Windows 9x/NT differences in handling it)
47 charset = 0;
48 }
49 else
50 {
f3078f07 51 if ( wxSscanf( tmp, wxT("%u"), &charset ) != 1 )
72e7876b 52 // should be a number!
f3078f07 53 return false;
72e7876b
SC
54 }
55
f3078f07 56 return true;
72e7876b
SC
57}
58
59wxString wxNativeEncodingInfo::ToString() const
60{
2f1ae414 61 wxString s(facename);
72e7876b 62 if ( charset != 0 )
f3078f07 63 s << wxT(';') << charset;
72e7876b
SC
64
65 return s;
66}
67
68// ----------------------------------------------------------------------------
69// helper functions
70// ----------------------------------------------------------------------------
71
f3078f07 72bool wxGetNativeFontEncoding( wxFontEncoding encoding, wxNativeEncodingInfo *info )
72e7876b 73{
f3078f07 74 wxCHECK_MSG( info, false, wxT("bad pointer in wxGetNativeFontEncoding") );
72e7876b
SC
75
76 if ( encoding == wxFONTENCODING_DEFAULT )
72e7876b 77 encoding = wxFont::GetDefaultEncoding();
72e7876b 78
f3078f07 79 info->encoding = encoding;
72e7876b 80
f3078f07 81 return true;
72e7876b
SC
82}
83
89954433 84bool wxTestFontEncoding( const wxNativeEncodingInfo& WXUNUSED(info) )
72e7876b 85{
f3078f07
DS
86 // basically we should be able to support every encoding via the OS
87 return true;
72e7876b 88}