2 % automatically generated by HelpGen from
3 % fontmap.h at 10/Mar/00 23:54:16
6 \section{\class{wxFontMapper
}}\label{wxfontmapper
}
8 wxFontMapper manages user-definable correspondence between logical font
9 names and the fonts present on the machine.
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
14 be disabled by giving the value of false to "interactive" parameter.
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
19 never true, the config file is never created anyhow.
21 In case everything else fails (i.e. there is no record in config file
22 and "interactive" is false or user denied to choose any replacement),
23 the class queries
\helpref{wxEncodingConverter
}{wxencodingconverter
}
24 for "equivalent" encodings (e.g. iso8859-
2 and cp1250) and tries them.
26 \wxheading{Using wxFontMapper in conjunction with wxMBConv classes
}
28 If you need to display text in encoding which is not available at
29 host system (see
\helpref{IsEncodingAvailable
}{wxfontmapperisencodingavailable
}),
30 you may use these two classes to find font in some similar encoding
31 (see
\helpref{GetAltForEncoding
}{wxfontmappergetaltforencoding
})
32 and convert the text to this encoding
33 (
\helpref{wxMBConv classes
}{mbconvclasses
}).
35 Following code snippet demonstrates it:
38 if (!wxFontMapper::Get()->IsEncodingAvailable(enc, facename))
40 wxFontEncoding alternative;
41 if (wxFontMapper::Get()->GetAltForEncoding(enc, &alternative,
44 wxCSConv convFrom(wxFontMapper::Get()->GetEncodingName(enc));
45 wxCSConv convTo(wxFontMapper::Get()->GetEncodingName(alternative));
46 text = wxString(text.mb_str(convFrom), convTo);
49 ...failure (or we may try iso8859-
1/
7bit ASCII)...
55 \wxheading{Derived from
}
59 \wxheading{Include files
}
65 \helpref{wxEncodingConverter
}{wxencodingconverter
},
66 \helpref{Writing non-English applications
}{nonenglishoverview
}
68 \latexignore{\rtfignore{\wxheading{Members
}}}
71 \membersection{wxFontMapper::wxFontMapper
}\label{wxfontmapperwxfontmapper
}
73 \func{}{wxFontMapper
}{\void}
79 The preferred way of creating a wxFontMapper instance is to call
80 \helpref{wxFontMapper::Get
}{wxfontmapperget
}.
83 \membersection{wxFontMapper::
\destruct{wxFontMapper
}}\label{wxfontmapperdtor
}
85 \func{}{\destruct{wxFontMapper
}}{\void}
87 Virtual dtor for a base class.
90 \membersection{wxFontMapper::CharsetToEncoding
}\label{wxfontmappercharsettoencoding
}
92 \func{wxFontEncoding
}{CharsetToEncoding
}{\param{const wxString\&
}{charset
},
\param{bool
}{interactive = true
}}
94 Returns the encoding for the given charset (in the form of RFC
2046) or
95 \texttt{wxFONTENCODING
\_SYSTEM} if couldn't decode it.
97 Be 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
99 may lead to unexpected reentrancies and may also take a significantly longer
100 time than a simple function call. For these reasons, it is almost always a bad
101 idea to call this function from the event handlers for repeatedly generated
102 events such as
\texttt{EVT
\_PAINT}.
105 \membersection{wxFontMapper::Get
}\label{wxfontmapperget
}
107 \func{static wxFontMapper *
}{Get
}{\void}
109 Get the current font mapper object. If there is no current object, creates
114 \helpref{wxFontMapper::Set
}{wxfontmapperset
}
117 \membersection{wxFontMapper::GetAllEncodingNames
}\label{wxfontmappergetallencodingnames
}
119 \func{static const wxChar**
}{GetAllEncodingNames
}{\param{wxFontEncoding
}{encoding
}}
121 Returns 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
123 encoding name, i.e. the same string as returned by
124 \helpref{GetEncodingName()
}{wxfontmappergetencodingname
}.
127 \membersection{wxFontMapper::GetAltForEncoding
}\label{wxfontmappergetaltforencoding
}
129 \func{bool
}{GetAltForEncoding
}{\param{wxFontEncoding
}{encoding
},
\param{wxNativeEncodingInfo*
}{info
},
\param{const wxString\&
}{facename = wxEmptyString
},
\param{bool
}{interactive = true
}}
131 \func{bool
}{GetAltForEncoding
}{\param{wxFontEncoding
}{encoding
},
\param{wxFontEncoding*
}{alt
\_encoding},
\param{const wxString\&
}{facename = wxEmptyString
},
\param{bool
}{interactive = true
}}
133 Find an alternative for the given encoding (which is supposed to not be
134 available on this system). If successful, return true and fill info
135 structure with the parameters required to create the font, otherwise
138 The first form is for wxWidgets' internal use while the second one
139 is better suitable for general use -- it returns wxFontEncoding which
140 can consequently be passed to wxFont constructor.
143 \membersection{wxFontMapper::GetEncoding
}\label{wxfontmappergetencoding
}
145 \func{static wxFontEncoding
}{GetEncoding
}{\param{size
\_t }{n
}}
147 Returns the
{\it n
}-th supported encoding. Together with
148 \helpref{GetSupportedEncodingsCount()
}{wxfontmappergetsupportedencodingscount
}
149 this method may be used to get all supported encodings.
152 \membersection{wxFontMapper::GetEncodingDescription
}\label{wxfontmappergetencodingdescription
}
154 \func{static wxString
}{GetEncodingDescription
}{\param{wxFontEncoding
}{encoding
}}
156 Return user-readable string describing the given encoding.
159 \membersection{wxFontMapper::GetEncodingFromName
}\label{wxfontmappergetencodingfromname
}
161 \func{static wxFontEncoding
}{GetEncodingFromName
}{\param{const wxString\&
}{encoding
}}
163 Return the encoding corresponding to the given internal name. This function is
164 the inverse of
\helpref{GetEncodingName
}{wxfontmappergetencodingname
} and is
165 intentionally less general than
166 \helpref{CharsetToEncoding
}{wxfontmappercharsettoencoding
}, i.e. it doesn't
167 try to make any guesses nor ever asks the user. It is meant just as a way of
168 restoring objects previously serialized using
169 \helpref{GetEncodingName
}{wxfontmappergetencodingname
}.
172 \membersection{wxFontMapper::GetEncodingName
}\label{wxfontmappergetencodingname
}
174 \func{static wxString
}{GetEncodingName
}{\param{wxFontEncoding
}{encoding
}}
176 Return internal string identifier for the encoding (see also
177 \helpref{GetEncodingDescription()
}{wxfontmappergetencodingdescription
})
181 \helpref{GetEncodingFromName
}{wxfontmappergetencodingfromname
}
184 \membersection{wxFontMapper::GetSupportedEncodingsCount
}\label{wxfontmappergetsupportedencodingscount
}
186 \func{static size
\_t}{GetSupportedEncodingsCount
}{\void}
188 Returns the number of the font encodings supported by this class. Together with
189 \helpref{GetEncoding
}{wxfontmappergetencoding
} this method may be used to get
190 all supported encodings.
193 \membersection{wxFontMapper::IsEncodingAvailable
}\label{wxfontmapperisencodingavailable
}
195 \func{bool
}{IsEncodingAvailable
}{\param{wxFontEncoding
}{encoding
},
\param{const wxString\&
}{facename = wxEmptyString
}}
197 Check whether given encoding is available in given face or not.
198 If no facename is given, find
{\it any
} font in this encoding.
201 \membersection{wxFontMapper::SetDialogParent
}\label{wxfontmappersetdialogparent
}
203 \func{void
}{SetDialogParent
}{\param{wxWindow*
}{parent
}}
205 The parent window for modal dialogs.
208 \membersection{wxFontMapper::SetDialogTitle
}\label{wxfontmappersetdialogtitle
}
210 \func{void
}{SetDialogTitle
}{\param{const wxString\&
}{title
}}
212 The title for the dialogs (note that default is quite reasonable).
215 \membersection{wxFontMapper::Set
}\label{wxfontmapperset
}
217 \func{static wxFontMapper *
}{Set
}{\param{wxFontMapper *
}{mapper
}}
219 Set the current font mapper object and return previous one (may be NULL).
220 This method is only useful if you want to plug-in an alternative font mapper
225 \helpref{wxFontMapper::Get
}{wxfontmapperget
}
228 \membersection{wxFontMapper::SetConfig
}\label{wxfontmappersetconfig
}
230 \func{void
}{SetConfig
}{\param{wxConfigBase*
}{config
}}
232 Set the config object to use (may be NULL to use default).
234 By default, the global one (from wxConfigBase::Get() will be used)
235 and the default root path for the config settings is the string returned by
236 GetDefaultConfigPath().
239 \membersection{wxFontMapper::SetConfigPath
}\label{wxfontmappersetconfigpath
}
241 \func{void
}{SetConfigPath
}{\param{const wxString\&
}{prefix
}}
243 Set the root config path to use (should be an absolute path).