]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/fontmap.tex
wxSetEnv for Win32 (now seems to work)
[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
26\wxheading{Global variables}
27
28{\tt wxFontMapper *wxTheFontMapper} is defined.
29
30\wxheading{Using wxFontMapper in conjunction with wxEncodingConverter}
31
32If you need to display text in encoding which is not available at
33host system (see \helpref{IsEncodingAvailable}{wxfontmapperisencodingavailable}),
34you may use these two classes to a) find font in some similar encoding
35(see \helpref{GetAltForEncoding}{wxfontmappergetaltforencoding})
36and
37b) convert the text to this encoding
38(\helpref{wxEncodingConverter::Convert}{wxencodingconverterconvert}).
39
40Following code snippet demonstrates it:
41
42\begin{verbatim}
43if (!wxTheFontMapper->IsEncodingAvailable(enc, facename))
44{
45 wxFontEncoding alternative;
46 if (wxTheFontMapper->GetAltForEncoding(enc, &alternative,
47 facename, FALSE))
48 {
49 wxEncodingConverter encconv;
50 if (!encconv.Init(enc, alternative))
51 ...failure...
52 else
53 text = encconv.Convert(text);
54 }
55 else
56 ...failure (or we may try iso8859-1/7bit ASCII)...
57}
58...display text...
59\end{verbatim}
60
61
62\wxheading{Derived from}
63
64No base class
65
66\wxheading{Include files}
67
68<wx/fontmap.h>
69
70\wxheading{See also}
71
72\helpref{wxEncodingConverter}{wxencodingconverter},
73\helpref{Writing non-English applications}{nonenglishoverview}
74
04a4a2af
VS
75\latexignore{\rtfignore{\wxheading{Members}}}
76
77\membersection{wxFontMapper::wxFontMapper}\label{wxfontmapperwxfontmapper}
78
79\func{}{wxFontMapper}{\void}
80
81Default ctor.
82
04a4a2af
VS
83\membersection{wxFontMapper::\destruct{wxFontMapper}}\label{wxfontmapperdtor}
84
85\func{}{\destruct{wxFontMapper}}{\void}
86
87Virtual dtor for a base class.
88
04a4a2af
VS
89\membersection{wxFontMapper::GetAltForEncoding}\label{wxfontmappergetaltforencoding}
90
91\func{bool}{GetAltForEncoding}{\param{wxFontEncoding }{encoding}, \param{wxNativeEncodingInfo* }{info}, \param{const wxString\& }{facename = wxEmptyString}, \param{bool }{interactive = TRUE}}
92
93\func{bool}{GetAltForEncoding}{\param{wxFontEncoding }{encoding}, \param{wxFontEncoding* }{alt\_encoding}, \param{const wxString\& }{facename = wxEmptyString}, \param{bool }{interactive = TRUE}}
94
95Find an alternative for the given encoding (which is supposed to not be
96available on this system). If successful, return TRUE and fill info
97structure with the parameters required to create the font, otherwise
98return FALSE.
99
100The first form is for wxWindows' internal use while the second one
101is better suitable for general use -- it returns wxFontEncoding which
102can consequently be passed to wxFont constructor.
103
04a4a2af
VS
104\membersection{wxFontMapper::IsEncodingAvailable}\label{wxfontmapperisencodingavailable}
105
106\func{bool}{IsEncodingAvailable}{\param{wxFontEncoding }{encoding}, \param{const wxString\& }{facename = wxEmptyString}}
107
108Check whether given encoding is available in given face or not.
109If no facename is given, find {\it any} font in this encoding.
110
04a4a2af
VS
111\membersection{wxFontMapper::CharsetToEncoding}\label{wxfontmappercharsettoencoding}
112
113\func{wxFontEncoding}{CharsetToEncoding}{\param{const wxString\& }{charset}, \param{bool }{interactive = TRUE}}
114
115Returns the encoding for the given charset (in the form of RFC 2046) or
116wxFONTENCODING\_SYSTEM if couldn't decode it.
117
04a4a2af
VS
118\membersection{wxFontMapper::GetEncodingName}\label{wxfontmappergetencodingname}
119
120\func{static wxString}{GetEncodingName}{\param{wxFontEncoding }{encoding}}
121
fa482912 122Return internal string identifier for the encoding (see also
04a4a2af
VS
123\helpref{GetEncodingDescription()}{wxfontmappergetencodingdescription})
124
04a4a2af
VS
125\membersection{wxFontMapper::GetEncodingDescription}\label{wxfontmappergetencodingdescription}
126
127\func{static wxString}{GetEncodingDescription}{\param{wxFontEncoding }{encoding}}
128
129Return user-readable string describing the given encoding.
130
04a4a2af
VS
131\membersection{wxFontMapper::SetDialogParent}\label{wxfontmappersetdialogparent}
132
133\func{void}{SetDialogParent}{\param{wxWindow* }{parent}}
134
135The parent window for modal dialogs.
136
04a4a2af
VS
137\membersection{wxFontMapper::SetDialogTitle}\label{wxfontmappersetdialogtitle}
138
139\func{void}{SetDialogTitle}{\param{const wxString\& }{title}}
140
141The title for the dialogs (note that default is quite reasonable).
142
04a4a2af
VS
143\membersection{wxFontMapper::SetConfig}\label{wxfontmappersetconfig}
144
145\func{void}{SetConfig}{\param{wxConfigBase* }{config}}
146
147Set the config object to use (may be NULL to use default).
148
149By default, the global one (from wxConfigBase::Get() will be used)
150and the default root path for the config settings is the string returned by
151GetDefaultConfigPath().
152
153\membersection{wxFontMapper::SetConfigPath}\label{wxfontmappersetconfigpath}
154
155\func{void}{SetConfigPath}{\param{const wxString\& }{prefix}}
156
157Set the root config path to use (should be an absolute path).
cd77c085 158