The default implementations of all functions will ask the user if they are
not capable of finding the answer themselves and store the answer in a
config file (configurable via SetConfigXXX functions). This behaviour may
-be disabled by giving the value of FALSE to "interactive" parameter.
+be disabled by giving the value of false to "interactive" parameter.
However, the functions will always consult the config file to allow the
user-defined values override the default logic and there is no way to
disable this - which shouldn't be ever needed because if "interactive" was
-never TRUE, the config file is never created anyhow.
+never true, the config file is never created anyhow.
In case everything else fails (i.e. there is no record in config file
-and "interactive" is FALSE or user denied to choose any replacement),
+and "interactive" is false or user denied to choose any replacement),
the class queries \helpref{wxEncodingConverter}{wxencodingconverter}
for "equivalent" encodings (e.g. iso8859-2 and cp1250) and tries them.
-\wxheading{Using wxFontMapper in conjunction with wxEncodingConverter}
+\wxheading{Using wxFontMapper in conjunction with wxMBConv classes}
If you need to display text in encoding which is not available at
host system (see \helpref{IsEncodingAvailable}{wxfontmapperisencodingavailable}),
you may use these two classes to find font in some similar encoding
(see \helpref{GetAltForEncoding}{wxfontmappergetaltforencoding})
and convert the text to this encoding
-(\helpref{wxEncodingConverter::Convert}{wxencodingconverterconvert}).
+(\helpref{wxMBConv classes}{mbconvclasses}).
Following code snippet demonstrates it:
{
wxFontEncoding alternative;
if (wxFontMapper::Get()->GetAltForEncoding(enc, &alternative,
- facename, FALSE))
+ facename, false))
{
- wxEncodingConverter encconv;
- if (!encconv.Init(enc, alternative))
- ...failure...
- else
- text = encconv.Convert(text);
+ wxCSConv convFrom(wxFontMapper::Get()->GetEncodingName(enc));
+ wxCSConv convTo(wxFontMapper::Get()->GetEncodingName(alternative));
+ text = wxString(text.mb_str(convFrom), convTo);
}
else
...failure (or we may try iso8859-1/7bit ASCII)...
\membersection{wxFontMapper::GetAltForEncoding}\label{wxfontmappergetaltforencoding}
-\func{bool}{GetAltForEncoding}{\param{wxFontEncoding }{encoding}, \param{wxNativeEncodingInfo* }{info}, \param{const wxString\& }{facename = wxEmptyString}, \param{bool }{interactive = TRUE}}
+\func{bool}{GetAltForEncoding}{\param{wxFontEncoding }{encoding}, \param{wxNativeEncodingInfo* }{info}, \param{const wxString\& }{facename = wxEmptyString}, \param{bool }{interactive = true}}
-\func{bool}{GetAltForEncoding}{\param{wxFontEncoding }{encoding}, \param{wxFontEncoding* }{alt\_encoding}, \param{const wxString\& }{facename = wxEmptyString}, \param{bool }{interactive = TRUE}}
+\func{bool}{GetAltForEncoding}{\param{wxFontEncoding }{encoding}, \param{wxFontEncoding* }{alt\_encoding}, \param{const wxString\& }{facename = wxEmptyString}, \param{bool }{interactive = true}}
Find an alternative for the given encoding (which is supposed to not be
-available on this system). If successful, return TRUE and fill info
+available on this system). If successful, return true and fill info
structure with the parameters required to create the font, otherwise
-return FALSE.
+return false.
The first form is for wxWindows' internal use while the second one
is better suitable for general use -- it returns wxFontEncoding which
\membersection{wxFontMapper::CharsetToEncoding}\label{wxfontmappercharsettoencoding}
-\func{wxFontEncoding}{CharsetToEncoding}{\param{const wxString\& }{charset}, \param{bool }{interactive = TRUE}}
+\func{wxFontEncoding}{CharsetToEncoding}{\param{const wxString\& }{charset}, \param{bool }{interactive = true}}
Returns the encoding for the given charset (in the form of RFC 2046) or
wxFONTENCODING\_SYSTEM if couldn't decode it.
+\membersection{wxFontMapper::GetEncoding}\label{wxfontmappergetencoding}
+
+\func{static wxFontEncoding}{GetEncoding}{\param{size\_t }{n}}
+
+Returns the {\it n}-th supported encoding. Together with
+\helpref{GetSupportedEncodingsCount()}{wxfontmappergetsupportedencodingscount}
+this method may be used to get all supported encodings.
+
+
\membersection{wxFontMapper::GetEncodingName}\label{wxfontmappergetencodingname}
\func{static wxString}{GetEncodingName}{\param{wxFontEncoding }{encoding}}
Return user-readable string describing the given encoding.
+\membersection{wxFontMapper::GetSupportedEncodingsCount}\label{wxfontmappergetsupportedencodingscount}
+
+\func{static size\_t}{GetSupportedEncodingsCount}{\void}
+
+Returns the number of the font encodings supported by this class. Together with
+\helpref{GetEncoding}{wxfontmappergetencoding} this method may be used to get
+all supported encodings.
+
+
\membersection{wxFontMapper::SetDialogParent}\label{wxfontmappersetdialogparent}
\func{void}{SetDialogParent}{\param{wxWindow* }{parent}}