]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/fontmap.tex
rename UpdatePulse() to Pulse() (forgot to commit with the rest of the changes)
[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
cc81d32f 14be disabled by giving the value of false to "interactive" parameter.
04a4a2af
VS
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
cc81d32f 19never true, the config file is never created anyhow.
04a4a2af
VS
20
21In case everything else fails (i.e. there is no record in config file
cc81d32f 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
a663cce7 26\wxheading{Using wxFontMapper in conjunction with wxMBConv classes}
04a4a2af
VS
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
a663cce7 33(\helpref{wxMBConv classes}{mbconvclasses}).
04a4a2af
VS
34
35Following code snippet demonstrates it:
36
37\begin{verbatim}
142b3bc2 38if (!wxFontMapper::Get()->IsEncodingAvailable(enc, facename))
04a4a2af
VS
39{
40 wxFontEncoding alternative;
142b3bc2 41 if (wxFontMapper::Get()->GetAltForEncoding(enc, &alternative,
cc81d32f 42 facename, false))
04a4a2af 43 {
a663cce7
VS
44 wxCSConv convFrom(wxFontMapper::Get()->GetEncodingName(enc));
45 wxCSConv convTo(wxFontMapper::Get()->GetEncodingName(alternative));
46 text = wxString(text.mb_str(convFrom), convTo);
04a4a2af
VS
47 }
48 else
49 ...failure (or we may try iso8859-1/7bit ASCII)...
50}
51...display text...
52\end{verbatim}
53
54
55\wxheading{Derived from}
56
57No base class
58
59\wxheading{Include files}
60
61<wx/fontmap.h>
62
63\wxheading{See also}
64
65\helpref{wxEncodingConverter}{wxencodingconverter},
66\helpref{Writing non-English applications}{nonenglishoverview}
67
04a4a2af
VS
68\latexignore{\rtfignore{\wxheading{Members}}}
69
910b9fc5 70
04a4a2af
VS
71\membersection{wxFontMapper::wxFontMapper}\label{wxfontmapperwxfontmapper}
72
73\func{}{wxFontMapper}{\void}
74
75Default ctor.
76
142b3bc2
VS
77\wxheading{Note}
78
79The preferred way of creating a wxFontMapper instance is to call
80\helpref{wxFontMapper::Get}{wxfontmapperget}.
81
910b9fc5 82
04a4a2af
VS
83\membersection{wxFontMapper::\destruct{wxFontMapper}}\label{wxfontmapperdtor}
84
85\func{}{\destruct{wxFontMapper}}{\void}
86
87Virtual dtor for a base class.
88
910b9fc5
VZ
89
90\membersection{wxFontMapper::CharsetToEncoding}\label{wxfontmappercharsettoencoding}
91
92\func{wxFontEncoding}{CharsetToEncoding}{\param{const wxString\& }{charset}, \param{bool }{interactive = true}}
93
94Returns the encoding for the given charset (in the form of RFC 2046) or
95\texttt{wxFONTENCODING\_SYSTEM} if couldn't decode it.
96
97Be careful when using this function with \arg{interactive} set to \true
98(default value) as the function then may show a dialog box to the user which
99may lead to unexpected reentrancies and may also take a significantly longer
100time than a simple function call. For these reasons, it is almost always a bad
101idea to call this function from the event handlers for repeatedly generated
102events such as \texttt{EVT\_PAINT}.
103
104
142b3bc2
VS
105\membersection{wxFontMapper::Get}\label{wxfontmapperget}
106
107\func{static wxFontMapper *}{Get}{\void}
108
109Get the current font mapper object. If there is no current object, creates
110one.
111
112\wxheading{See also}
113
114\helpref{wxFontMapper::Set}{wxfontmapperset}
115
910b9fc5 116
f69e752c 117\membersection{wxFontMapper::GetAllEncodingNames}\label{wxfontmappergetallencodingnames}
fa4bc07c
VZ
118
119\func{static const wxChar**}{GetAllEncodingNames}{\param{wxFontEncoding }{encoding}}
120
121Returns the array of all possible names for the given encoding. The array is
122\NULL-terminated. IF it isn't empty, the first name in it is the canonical
123encoding name, i.e. the same string as returned by
124\helpref{GetEncodingName()}{wxfontmappergetencodingname}.
125
126
04a4a2af
VS
127\membersection{wxFontMapper::GetAltForEncoding}\label{wxfontmappergetaltforencoding}
128
cc81d32f 129\func{bool}{GetAltForEncoding}{\param{wxFontEncoding }{encoding}, \param{wxNativeEncodingInfo* }{info}, \param{const wxString\& }{facename = wxEmptyString}, \param{bool }{interactive = true}}
04a4a2af 130
cc81d32f 131\func{bool}{GetAltForEncoding}{\param{wxFontEncoding }{encoding}, \param{wxFontEncoding* }{alt\_encoding}, \param{const wxString\& }{facename = wxEmptyString}, \param{bool }{interactive = true}}
04a4a2af
VS
132
133Find an alternative for the given encoding (which is supposed to not be
cc81d32f 134available on this system). If successful, return true and fill info
04a4a2af 135structure with the parameters required to create the font, otherwise
cc81d32f 136return false.
04a4a2af 137
fc2171bd 138The first form is for wxWidgets' internal use while the second one
04a4a2af
VS
139is better suitable for general use -- it returns wxFontEncoding which
140can consequently be passed to wxFont constructor.
141
04a4a2af 142
bf43ff9a
VZ
143\membersection{wxFontMapper::GetEncoding}\label{wxfontmappergetencoding}
144
145\func{static wxFontEncoding}{GetEncoding}{\param{size\_t }{n}}
146
147Returns the {\it n}-th supported encoding. Together with
148\helpref{GetSupportedEncodingsCount()}{wxfontmappergetsupportedencodingscount}
149this method may be used to get all supported encodings.
150
151
910b9fc5
VZ
152\membersection{wxFontMapper::GetEncodingDescription}\label{wxfontmappergetencodingdescription}
153
154\func{static wxString}{GetEncodingDescription}{\param{wxFontEncoding }{encoding}}
155
156Return user-readable string describing the given encoding.
157
158
159\membersection{wxFontMapper::GetEncodingFromName}\label{wxfontmappergetencodingfromname}
160
161\func{static wxFontEncoding}{GetEncodingFromName}{\param{const wxString\& }{encoding}}
162
163Return the encoding corresponding to the given internal name. This function is
164the inverse of \helpref{GetEncodingName}{wxfontmappergetencodingname} and is
165intentionally less general than
166\helpref{CharsetToEncoding}{wxfontmappercharsettoencoding}, i.e. it doesn't
167try to make any guesses nor ever asks the user. It is meant just as a way of
168restoring objects previously serialized using
169\helpref{GetEncodingName}{wxfontmappergetencodingname}.
170
171
04a4a2af
VS
172\membersection{wxFontMapper::GetEncodingName}\label{wxfontmappergetencodingname}
173
174\func{static wxString}{GetEncodingName}{\param{wxFontEncoding }{encoding}}
175
fa482912 176Return internal string identifier for the encoding (see also
04a4a2af
VS
177\helpref{GetEncodingDescription()}{wxfontmappergetencodingdescription})
178
910b9fc5 179\wxheading{See also}
04a4a2af 180
910b9fc5 181\helpref{GetEncodingFromName}{wxfontmappergetencodingfromname}
04a4a2af 182
04a4a2af 183
bf43ff9a
VZ
184\membersection{wxFontMapper::GetSupportedEncodingsCount}\label{wxfontmappergetsupportedencodingscount}
185
186\func{static size\_t}{GetSupportedEncodingsCount}{\void}
187
188Returns the number of the font encodings supported by this class. Together with
189\helpref{GetEncoding}{wxfontmappergetencoding} this method may be used to get
190all supported encodings.
191
192
910b9fc5
VZ
193\membersection{wxFontMapper::IsEncodingAvailable}\label{wxfontmapperisencodingavailable}
194
195\func{bool}{IsEncodingAvailable}{\param{wxFontEncoding }{encoding}, \param{const wxString\& }{facename = wxEmptyString}}
196
197Check whether given encoding is available in given face or not.
198If no facename is given, find {\it any} font in this encoding.
199
200
04a4a2af
VS
201\membersection{wxFontMapper::SetDialogParent}\label{wxfontmappersetdialogparent}
202
203\func{void}{SetDialogParent}{\param{wxWindow* }{parent}}
204
205The parent window for modal dialogs.
206
910b9fc5 207
04a4a2af
VS
208\membersection{wxFontMapper::SetDialogTitle}\label{wxfontmappersetdialogtitle}
209
210\func{void}{SetDialogTitle}{\param{const wxString\& }{title}}
211
212The title for the dialogs (note that default is quite reasonable).
213
910b9fc5 214
142b3bc2
VS
215\membersection{wxFontMapper::Set}\label{wxfontmapperset}
216
217\func{static wxFontMapper *}{Set}{\param{wxFontMapper *}{mapper}}
218
219Set the current font mapper object and return previous one (may be NULL).
220This method is only useful if you want to plug-in an alternative font mapper
fc2171bd 221into wxWidgets.
142b3bc2
VS
222
223\wxheading{See also}
224
225\helpref{wxFontMapper::Get}{wxfontmapperget}
226
910b9fc5 227
04a4a2af
VS
228\membersection{wxFontMapper::SetConfig}\label{wxfontmappersetconfig}
229
230\func{void}{SetConfig}{\param{wxConfigBase* }{config}}
231
232Set the config object to use (may be NULL to use default).
233
234By default, the global one (from wxConfigBase::Get() will be used)
235and the default root path for the config settings is the string returned by
236GetDefaultConfigPath().
237
910b9fc5 238
04a4a2af
VS
239\membersection{wxFontMapper::SetConfigPath}\label{wxfontmappersetconfigpath}
240
241\func{void}{SetConfigPath}{\param{const wxString\& }{prefix}}
242
243Set the root config path to use (should be an absolute path).
cd77c085 244