]>
Commit | Line | Data |
---|---|---|
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 |
8 | wxFontMapper manages user-definable correspondence between logical font |
9 | names and the fonts present on the machine. | |
10 | ||
11 | The default implementations of all functions will ask the user if they are | |
12 | not capable of finding the answer themselves and store the answer in a | |
13 | config file (configurable via SetConfigXXX functions). This behaviour may | |
cc81d32f | 14 | be disabled by giving the value of false to "interactive" parameter. |
04a4a2af VS |
15 | |
16 | However, the functions will always consult the config file to allow the | |
17 | user-defined values override the default logic and there is no way to | |
18 | disable this - which shouldn't be ever needed because if "interactive" was | |
cc81d32f | 19 | never true, the config file is never created anyhow. |
04a4a2af VS |
20 | |
21 | In case everything else fails (i.e. there is no record in config file | |
cc81d32f | 22 | and "interactive" is false or user denied to choose any replacement), |
fa482912 | 23 | the class queries \helpref{wxEncodingConverter}{wxencodingconverter} |
04a4a2af VS |
24 | for "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 | |
28 | If you need to display text in encoding which is not available at | |
29 | host system (see \helpref{IsEncodingAvailable}{wxfontmapperisencodingavailable}), | |
dccce9ea | 30 | you may use these two classes to find font in some similar encoding |
04a4a2af | 31 | (see \helpref{GetAltForEncoding}{wxfontmappergetaltforencoding}) |
dccce9ea | 32 | and convert the text to this encoding |
a663cce7 | 33 | (\helpref{wxMBConv classes}{mbconvclasses}). |
04a4a2af VS |
34 | |
35 | Following code snippet demonstrates it: | |
36 | ||
37 | \begin{verbatim} | |
142b3bc2 | 38 | if (!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 | ||
57 | No 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 | ||
70 | \membersection{wxFontMapper::wxFontMapper}\label{wxfontmapperwxfontmapper} | |
71 | ||
72 | \func{}{wxFontMapper}{\void} | |
73 | ||
74 | Default ctor. | |
75 | ||
142b3bc2 VS |
76 | \wxheading{Note} |
77 | ||
78 | The preferred way of creating a wxFontMapper instance is to call | |
79 | \helpref{wxFontMapper::Get}{wxfontmapperget}. | |
80 | ||
04a4a2af VS |
81 | \membersection{wxFontMapper::\destruct{wxFontMapper}}\label{wxfontmapperdtor} |
82 | ||
83 | \func{}{\destruct{wxFontMapper}}{\void} | |
84 | ||
85 | Virtual dtor for a base class. | |
86 | ||
142b3bc2 VS |
87 | \membersection{wxFontMapper::Get}\label{wxfontmapperget} |
88 | ||
89 | \func{static wxFontMapper *}{Get}{\void} | |
90 | ||
91 | Get the current font mapper object. If there is no current object, creates | |
92 | one. | |
93 | ||
94 | \wxheading{See also} | |
95 | ||
96 | \helpref{wxFontMapper::Set}{wxfontmapperset} | |
97 | ||
04a4a2af VS |
98 | \membersection{wxFontMapper::GetAltForEncoding}\label{wxfontmappergetaltforencoding} |
99 | ||
cc81d32f | 100 | \func{bool}{GetAltForEncoding}{\param{wxFontEncoding }{encoding}, \param{wxNativeEncodingInfo* }{info}, \param{const wxString\& }{facename = wxEmptyString}, \param{bool }{interactive = true}} |
04a4a2af | 101 | |
cc81d32f | 102 | \func{bool}{GetAltForEncoding}{\param{wxFontEncoding }{encoding}, \param{wxFontEncoding* }{alt\_encoding}, \param{const wxString\& }{facename = wxEmptyString}, \param{bool }{interactive = true}} |
04a4a2af VS |
103 | |
104 | Find an alternative for the given encoding (which is supposed to not be | |
cc81d32f | 105 | available on this system). If successful, return true and fill info |
04a4a2af | 106 | structure with the parameters required to create the font, otherwise |
cc81d32f | 107 | return false. |
04a4a2af VS |
108 | |
109 | The first form is for wxWindows' internal use while the second one | |
110 | is better suitable for general use -- it returns wxFontEncoding which | |
111 | can consequently be passed to wxFont constructor. | |
112 | ||
04a4a2af VS |
113 | \membersection{wxFontMapper::IsEncodingAvailable}\label{wxfontmapperisencodingavailable} |
114 | ||
115 | \func{bool}{IsEncodingAvailable}{\param{wxFontEncoding }{encoding}, \param{const wxString\& }{facename = wxEmptyString}} | |
116 | ||
117 | Check whether given encoding is available in given face or not. | |
118 | If no facename is given, find {\it any} font in this encoding. | |
119 | ||
04a4a2af VS |
120 | \membersection{wxFontMapper::CharsetToEncoding}\label{wxfontmappercharsettoencoding} |
121 | ||
cc81d32f | 122 | \func{wxFontEncoding}{CharsetToEncoding}{\param{const wxString\& }{charset}, \param{bool }{interactive = true}} |
04a4a2af VS |
123 | |
124 | Returns the encoding for the given charset (in the form of RFC 2046) or | |
125 | wxFONTENCODING\_SYSTEM if couldn't decode it. | |
126 | ||
bf43ff9a VZ |
127 | \membersection{wxFontMapper::GetEncoding}\label{wxfontmappergetencoding} |
128 | ||
129 | \func{static wxFontEncoding}{GetEncoding}{\param{size\_t }{n}} | |
130 | ||
131 | Returns the {\it n}-th supported encoding. Together with | |
132 | \helpref{GetSupportedEncodingsCount()}{wxfontmappergetsupportedencodingscount} | |
133 | this method may be used to get all supported encodings. | |
134 | ||
135 | ||
04a4a2af VS |
136 | \membersection{wxFontMapper::GetEncodingName}\label{wxfontmappergetencodingname} |
137 | ||
138 | \func{static wxString}{GetEncodingName}{\param{wxFontEncoding }{encoding}} | |
139 | ||
fa482912 | 140 | Return internal string identifier for the encoding (see also |
04a4a2af VS |
141 | \helpref{GetEncodingDescription()}{wxfontmappergetencodingdescription}) |
142 | ||
04a4a2af VS |
143 | \membersection{wxFontMapper::GetEncodingDescription}\label{wxfontmappergetencodingdescription} |
144 | ||
145 | \func{static wxString}{GetEncodingDescription}{\param{wxFontEncoding }{encoding}} | |
146 | ||
147 | Return user-readable string describing the given encoding. | |
148 | ||
bf43ff9a VZ |
149 | \membersection{wxFontMapper::GetSupportedEncodingsCount}\label{wxfontmappergetsupportedencodingscount} |
150 | ||
151 | \func{static size\_t}{GetSupportedEncodingsCount}{\void} | |
152 | ||
153 | Returns the number of the font encodings supported by this class. Together with | |
154 | \helpref{GetEncoding}{wxfontmappergetencoding} this method may be used to get | |
155 | all supported encodings. | |
156 | ||
157 | ||
04a4a2af VS |
158 | \membersection{wxFontMapper::SetDialogParent}\label{wxfontmappersetdialogparent} |
159 | ||
160 | \func{void}{SetDialogParent}{\param{wxWindow* }{parent}} | |
161 | ||
162 | The parent window for modal dialogs. | |
163 | ||
04a4a2af VS |
164 | \membersection{wxFontMapper::SetDialogTitle}\label{wxfontmappersetdialogtitle} |
165 | ||
166 | \func{void}{SetDialogTitle}{\param{const wxString\& }{title}} | |
167 | ||
168 | The title for the dialogs (note that default is quite reasonable). | |
169 | ||
142b3bc2 VS |
170 | \membersection{wxFontMapper::Set}\label{wxfontmapperset} |
171 | ||
172 | \func{static wxFontMapper *}{Set}{\param{wxFontMapper *}{mapper}} | |
173 | ||
174 | Set the current font mapper object and return previous one (may be NULL). | |
175 | This method is only useful if you want to plug-in an alternative font mapper | |
176 | into wxWindows. | |
177 | ||
178 | \wxheading{See also} | |
179 | ||
180 | \helpref{wxFontMapper::Get}{wxfontmapperget} | |
181 | ||
04a4a2af VS |
182 | \membersection{wxFontMapper::SetConfig}\label{wxfontmappersetconfig} |
183 | ||
184 | \func{void}{SetConfig}{\param{wxConfigBase* }{config}} | |
185 | ||
186 | Set the config object to use (may be NULL to use default). | |
187 | ||
188 | By default, the global one (from wxConfigBase::Get() will be used) | |
189 | and the default root path for the config settings is the string returned by | |
190 | GetDefaultConfigPath(). | |
191 | ||
192 | \membersection{wxFontMapper::SetConfigPath}\label{wxfontmappersetconfigpath} | |
193 | ||
194 | \func{void}{SetConfigPath}{\param{const wxString\& }{prefix}} | |
195 | ||
196 | Set the root config path to use (should be an absolute path). | |
cd77c085 | 197 |