]> git.saurik.com Git - wxWidgets.git/blame - src/osx/fontutil.cpp
replace the static control in wxMessageDialog with an edit control with a vertical...
[wxWidgets.git] / src / osx / fontutil.cpp
CommitLineData
489468fe 1///////////////////////////////////////////////////////////////////////////////
96dabe43
SC
2// Name: src/osx/fontutil.cpp
3// Purpose: font-related helper functions for OS X
4// Author: Vadim Zeitlin, Stefan Csomor
489468fe
SC
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#include "wx/wxprec.h"
13
14#ifdef __BORLANDC__
15 #pragma hdrstop
16#endif
17
18#ifndef WX_PRECOMP
19 #include "wx/string.h"
20 #include "wx/wxcrtvararg.h"
21 #include "wx/log.h"
22 #include "wx/intl.h"
23#endif
24
25#include "wx/fontutil.h"
26#include "wx/fontmap.h"
27#include "wx/encinfo.h"
28#include "wx/tokenzr.h"
29
30
31// convert to/from the string representation:
32// format is facename[;charset]
33//
34bool wxNativeEncodingInfo::FromString( const wxString& s )
35{
36 wxStringTokenizer tokenizer(s, wxT(";"));
37
38 facename = tokenizer.GetNextToken();
39 if ( !facename )
40 return false;
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 {
51 if ( wxSscanf( tmp, wxT("%u"), &charset ) != 1 )
52 // should be a number!
53 return false;
54 }
55
56 return true;
57}
58
59wxString wxNativeEncodingInfo::ToString() const
60{
61 wxString s(facename);
62 if ( charset != 0 )
63 s << wxT(';') << charset;
64
65 return s;
66}
67
68// ----------------------------------------------------------------------------
69// helper functions
70// ----------------------------------------------------------------------------
71
72bool wxGetNativeFontEncoding( wxFontEncoding encoding, wxNativeEncodingInfo *info )
73{
74 wxCHECK_MSG( info, false, wxT("bad pointer in wxGetNativeFontEncoding") );
75
76 if ( encoding == wxFONTENCODING_DEFAULT )
77 encoding = wxFont::GetDefaultEncoding();
78
79 info->encoding = encoding;
80
81 return true;
82}
83
84bool wxTestFontEncoding( const wxNativeEncodingInfo& WXUNUSED(info) )
85{
86 // basically we should be able to support every encoding via the OS
87 return true;
88}