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