]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/fontmap.tex
Added missing brace in checkbox.tex
[wxWidgets.git] / docs / latex / wx / fontmap.tex
CommitLineData
04a4a2af
VS
1%
2% automatically generated by HelpGen from
3% fontmap.h at 10/Mar/00 23:54:16
4%
775a998e
VZ
5
6\section{\class{wxFontMapper}}\label{wxfontmapper}
7
04a4a2af
VS
8wxFontMapper manages user-definable correspondence between logical font
9names and the fonts present on the machine.
10
11The default implementations of all functions will ask the user if they are
12not capable of finding the answer themselves and store the answer in a
13config file (configurable via SetConfigXXX functions). This behaviour may
14be disabled by giving the value of FALSE to "interactive" parameter.
15
16However, the functions will always consult the config file to allow the
17user-defined values override the default logic and there is no way to
18disable this - which shouldn't be ever needed because if "interactive" was
19never TRUE, the config file is never created anyhow.
20
21In case everything else fails (i.e. there is no record in config file
22and "interactive" is FALSE or user denied to choose any replacement),
fa482912 23the class queries \helpref{wxEncodingConverter}{wxencodingconverter}
04a4a2af
VS
24for "equivalent" encodings (e.g. iso8859-2 and cp1250) and tries them.
25
04a4a2af
VS
26\wxheading{Using wxFontMapper in conjunction with wxEncodingConverter}
27
28If you need to display text in encoding which is not available at
29host system (see \helpref{IsEncodingAvailable}{wxfontmapperisencodingavailable}),
dccce9ea 30you may use these two classes to find font in some similar encoding
04a4a2af 31(see \helpref{GetAltForEncoding}{wxfontmappergetaltforencoding})
dccce9ea 32and convert the text to this encoding
04a4a2af
VS
33(\helpref{wxEncodingConverter::Convert}{wxencodingconverterconvert}).
34
35Following code snippet demonstrates it:
36
37\begin{verbatim}
142b3bc2 38if (!wxFontMapper::Get()->IsEncodingAvailable(enc, facename))
04a4a2af
VS
39{
40 wxFontEncoding alternative;
142b3bc2
VS
41 if (wxFontMapper::Get()->GetAltForEncoding(enc, &alternative,
42 facename, FALSE))
04a4a2af
VS
43 {
44 wxEncodingConverter encconv;
45 if (!encconv.Init(enc, alternative))
46 ...failure...
47 else
48 text = encconv.Convert(text);
49 }
50 else
51 ...failure (or we may try iso8859-1/7bit ASCII)...
52}
53...display text...
54\end{verbatim}
55
56
57\wxheading{Derived from}
58
59No base class
60
61\wxheading{Include files}
62
63<wx/fontmap.h>
64
65\wxheading{See also}
66
67\helpref{wxEncodingConverter}{wxencodingconverter},
68\helpref{Writing non-English applications}{nonenglishoverview}
69
04a4a2af
VS
70\latexignore{\rtfignore{\wxheading{Members}}}
71
72\membersection{wxFontMapper::wxFontMapper}\label{wxfontmapperwxfontmapper}
73
74\func{}{wxFontMapper}{\void}
75
76Default ctor.
77
142b3bc2
VS
78\wxheading{Note}
79
80The preferred way of creating a wxFontMapper instance is to call
81\helpref{wxFontMapper::Get}{wxfontmapperget}.
82
04a4a2af
VS
83\membersection{wxFontMapper::\destruct{wxFontMapper}}\label{wxfontmapperdtor}
84
85\func{}{\destruct{wxFontMapper}}{\void}
86
87Virtual dtor for a base class.
88
142b3bc2
VS
89\membersection{wxFontMapper::Get}\label{wxfontmapperget}
90
91\func{static wxFontMapper *}{Get}{\void}
92
93Get the current font mapper object. If there is no current object, creates
94one.
95
96\wxheading{See also}
97
98\helpref{wxFontMapper::Set}{wxfontmapperset}
99
04a4a2af
VS
100\membersection{wxFontMapper::GetAltForEncoding}\label{wxfontmappergetaltforencoding}
101
102\func{bool}{GetAltForEncoding}{\param{wxFontEncoding }{encoding}, \param{wxNativeEncodingInfo* }{info}, \param{const wxString\& }{facename = wxEmptyString}, \param{bool }{interactive = TRUE}}
103
104\func{bool}{GetAltForEncoding}{\param{wxFontEncoding }{encoding}, \param{wxFontEncoding* }{alt\_encoding}, \param{const wxString\& }{facename = wxEmptyString}, \param{bool }{interactive = TRUE}}
105
106Find an alternative for the given encoding (which is supposed to not be
107available on this system). If successful, return TRUE and fill info
108structure with the parameters required to create the font, otherwise
109return FALSE.
110
111The first form is for wxWindows' internal use while the second one
112is better suitable for general use -- it returns wxFontEncoding which
113can consequently be passed to wxFont constructor.
114
04a4a2af
VS
115\membersection{wxFontMapper::IsEncodingAvailable}\label{wxfontmapperisencodingavailable}
116
117\func{bool}{IsEncodingAvailable}{\param{wxFontEncoding }{encoding}, \param{const wxString\& }{facename = wxEmptyString}}
118
119Check whether given encoding is available in given face or not.
120If no facename is given, find {\it any} font in this encoding.
121
04a4a2af
VS
122\membersection{wxFontMapper::CharsetToEncoding}\label{wxfontmappercharsettoencoding}
123
124\func{wxFontEncoding}{CharsetToEncoding}{\param{const wxString\& }{charset}, \param{bool }{interactive = TRUE}}
125
126Returns the encoding for the given charset (in the form of RFC 2046) or
127wxFONTENCODING\_SYSTEM if couldn't decode it.
128
04a4a2af
VS
129\membersection{wxFontMapper::GetEncodingName}\label{wxfontmappergetencodingname}
130
131\func{static wxString}{GetEncodingName}{\param{wxFontEncoding }{encoding}}
132
fa482912 133Return internal string identifier for the encoding (see also
04a4a2af
VS
134\helpref{GetEncodingDescription()}{wxfontmappergetencodingdescription})
135
04a4a2af
VS
136\membersection{wxFontMapper::GetEncodingDescription}\label{wxfontmappergetencodingdescription}
137
138\func{static wxString}{GetEncodingDescription}{\param{wxFontEncoding }{encoding}}
139
140Return user-readable string describing the given encoding.
141
04a4a2af
VS
142\membersection{wxFontMapper::SetDialogParent}\label{wxfontmappersetdialogparent}
143
144\func{void}{SetDialogParent}{\param{wxWindow* }{parent}}
145
146The parent window for modal dialogs.
147
04a4a2af
VS
148\membersection{wxFontMapper::SetDialogTitle}\label{wxfontmappersetdialogtitle}
149
150\func{void}{SetDialogTitle}{\param{const wxString\& }{title}}
151
152The title for the dialogs (note that default is quite reasonable).
153
142b3bc2
VS
154\membersection{wxFontMapper::Set}\label{wxfontmapperset}
155
156\func{static wxFontMapper *}{Set}{\param{wxFontMapper *}{mapper}}
157
158Set the current font mapper object and return previous one (may be NULL).
159This method is only useful if you want to plug-in an alternative font mapper
160into wxWindows.
161
162\wxheading{See also}
163
164\helpref{wxFontMapper::Get}{wxfontmapperget}
165
04a4a2af
VS
166\membersection{wxFontMapper::SetConfig}\label{wxfontmappersetconfig}
167
168\func{void}{SetConfig}{\param{wxConfigBase* }{config}}
169
170Set the config object to use (may be NULL to use default).
171
172By default, the global one (from wxConfigBase::Get() will be used)
173and the default root path for the config settings is the string returned by
174GetDefaultConfigPath().
175
176\membersection{wxFontMapper::SetConfigPath}\label{wxfontmappersetconfigpath}
177
178\func{void}{SetConfigPath}{\param{const wxString\& }{prefix}}
179
180Set the root config path to use (should be an absolute path).
cd77c085 181