2000-03-11 05:05:40 -05:00
|
|
|
%
|
|
|
|
% automatically generated by HelpGen from
|
|
|
|
% fontmap.h at 10/Mar/00 23:54:16
|
|
|
|
%
|
1999-11-03 18:51:07 -05:00
|
|
|
|
|
|
|
\section{\class{wxFontMapper}}\label{wxfontmapper}
|
|
|
|
|
2000-03-11 05:05:40 -05:00
|
|
|
wxFontMapper manages user-definable correspondence between logical font
|
|
|
|
names and the fonts present on the machine.
|
|
|
|
|
|
|
|
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
|
2003-01-17 19:16:34 -05:00
|
|
|
be disabled by giving the value of false to "interactive" parameter.
|
2000-03-11 05:05:40 -05:00
|
|
|
|
|
|
|
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
|
2003-01-17 19:16:34 -05:00
|
|
|
never true, the config file is never created anyhow.
|
2000-03-11 05:05:40 -05:00
|
|
|
|
|
|
|
In case everything else fails (i.e. there is no record in config file
|
2003-01-17 19:16:34 -05:00
|
|
|
and "interactive" is false or user denied to choose any replacement),
|
2000-03-14 19:21:49 -05:00
|
|
|
the class queries \helpref{wxEncodingConverter}{wxencodingconverter}
|
2000-03-11 05:05:40 -05:00
|
|
|
for "equivalent" encodings (e.g. iso8859-2 and cp1250) and tries them.
|
|
|
|
|
2003-01-23 14:49:53 -05:00
|
|
|
\wxheading{Using wxFontMapper in conjunction with wxMBConv classes}
|
2000-03-11 05:05:40 -05:00
|
|
|
|
|
|
|
If you need to display text in encoding which is not available at
|
|
|
|
host system (see \helpref{IsEncodingAvailable}{wxfontmapperisencodingavailable}),
|
2001-05-31 16:27:37 -04:00
|
|
|
you may use these two classes to find font in some similar encoding
|
2000-03-11 05:05:40 -05:00
|
|
|
(see \helpref{GetAltForEncoding}{wxfontmappergetaltforencoding})
|
2001-05-31 16:27:37 -04:00
|
|
|
and convert the text to this encoding
|
2003-01-23 14:49:53 -05:00
|
|
|
(\helpref{wxMBConv classes}{mbconvclasses}).
|
2000-03-11 05:05:40 -05:00
|
|
|
|
|
|
|
Following code snippet demonstrates it:
|
|
|
|
|
|
|
|
\begin{verbatim}
|
2002-04-06 10:04:27 -05:00
|
|
|
if (!wxFontMapper::Get()->IsEncodingAvailable(enc, facename))
|
2000-03-11 05:05:40 -05:00
|
|
|
{
|
|
|
|
wxFontEncoding alternative;
|
2002-04-06 10:04:27 -05:00
|
|
|
if (wxFontMapper::Get()->GetAltForEncoding(enc, &alternative,
|
2003-01-17 19:16:34 -05:00
|
|
|
facename, false))
|
2000-03-11 05:05:40 -05:00
|
|
|
{
|
2003-01-23 14:49:53 -05:00
|
|
|
wxCSConv convFrom(wxFontMapper::Get()->GetEncodingName(enc));
|
|
|
|
wxCSConv convTo(wxFontMapper::Get()->GetEncodingName(alternative));
|
|
|
|
text = wxString(text.mb_str(convFrom), convTo);
|
2000-03-11 05:05:40 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
...failure (or we may try iso8859-1/7bit ASCII)...
|
|
|
|
}
|
|
|
|
...display text...
|
|
|
|
\end{verbatim}
|
|
|
|
|
|
|
|
|
|
|
|
\wxheading{Derived from}
|
|
|
|
|
|
|
|
No base class
|
|
|
|
|
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/fontmap.h>
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxEncodingConverter}{wxencodingconverter},
|
|
|
|
\helpref{Writing non-English applications}{nonenglishoverview}
|
|
|
|
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
2004-04-11 06:40:04 -04:00
|
|
|
|
2000-03-11 05:05:40 -05:00
|
|
|
\membersection{wxFontMapper::wxFontMapper}\label{wxfontmapperwxfontmapper}
|
|
|
|
|
|
|
|
\func{}{wxFontMapper}{\void}
|
|
|
|
|
|
|
|
Default ctor.
|
|
|
|
|
2002-04-06 10:04:27 -05:00
|
|
|
\wxheading{Note}
|
|
|
|
|
|
|
|
The preferred way of creating a wxFontMapper instance is to call
|
|
|
|
\helpref{wxFontMapper::Get}{wxfontmapperget}.
|
|
|
|
|
2004-04-11 06:40:04 -04:00
|
|
|
|
2000-03-11 05:05:40 -05:00
|
|
|
\membersection{wxFontMapper::\destruct{wxFontMapper}}\label{wxfontmapperdtor}
|
|
|
|
|
|
|
|
\func{}{\destruct{wxFontMapper}}{\void}
|
|
|
|
|
|
|
|
Virtual dtor for a base class.
|
|
|
|
|
2004-04-11 06:40:04 -04:00
|
|
|
|
|
|
|
\membersection{wxFontMapper::CharsetToEncoding}\label{wxfontmappercharsettoencoding}
|
|
|
|
|
|
|
|
\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
|
|
|
|
\texttt{wxFONTENCODING\_SYSTEM} if couldn't decode it.
|
|
|
|
|
|
|
|
Be careful when using this function with \arg{interactive} set to \true
|
|
|
|
(default value) as the function then may show a dialog box to the user which
|
|
|
|
may lead to unexpected reentrancies and may also take a significantly longer
|
|
|
|
time than a simple function call. For these reasons, it is almost always a bad
|
|
|
|
idea to call this function from the event handlers for repeatedly generated
|
|
|
|
events such as \texttt{EVT\_PAINT}.
|
|
|
|
|
|
|
|
|
2002-04-06 10:04:27 -05:00
|
|
|
\membersection{wxFontMapper::Get}\label{wxfontmapperget}
|
|
|
|
|
|
|
|
\func{static wxFontMapper *}{Get}{\void}
|
|
|
|
|
|
|
|
Get the current font mapper object. If there is no current object, creates
|
|
|
|
one.
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxFontMapper::Set}{wxfontmapperset}
|
|
|
|
|
2004-04-11 06:40:04 -04:00
|
|
|
|
2000-03-11 05:05:40 -05:00
|
|
|
\membersection{wxFontMapper::GetAltForEncoding}\label{wxfontmappergetaltforencoding}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
\func{bool}{GetAltForEncoding}{\param{wxFontEncoding }{encoding}, \param{wxNativeEncodingInfo* }{info}, \param{const wxString\& }{facename = wxEmptyString}, \param{bool }{interactive = true}}
|
2000-03-11 05:05:40 -05:00
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
\func{bool}{GetAltForEncoding}{\param{wxFontEncoding }{encoding}, \param{wxFontEncoding* }{alt\_encoding}, \param{const wxString\& }{facename = wxEmptyString}, \param{bool }{interactive = true}}
|
2000-03-11 05:05:40 -05:00
|
|
|
|
|
|
|
Find an alternative for the given encoding (which is supposed to not be
|
2003-01-17 19:16:34 -05:00
|
|
|
available on this system). If successful, return true and fill info
|
2000-03-11 05:05:40 -05:00
|
|
|
structure with the parameters required to create the font, otherwise
|
2003-01-17 19:16:34 -05:00
|
|
|
return false.
|
2000-03-11 05:05:40 -05:00
|
|
|
|
2004-05-04 04:27:20 -04:00
|
|
|
The first form is for wxWidgets' internal use while the second one
|
2000-03-11 05:05:40 -05:00
|
|
|
is better suitable for general use -- it returns wxFontEncoding which
|
|
|
|
can consequently be passed to wxFont constructor.
|
|
|
|
|
|
|
|
|
2003-06-22 18:20:40 -04:00
|
|
|
\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.
|
|
|
|
|
|
|
|
|
2004-04-11 06:40:04 -04:00
|
|
|
\membersection{wxFontMapper::GetEncodingDescription}\label{wxfontmappergetencodingdescription}
|
|
|
|
|
|
|
|
\func{static wxString}{GetEncodingDescription}{\param{wxFontEncoding }{encoding}}
|
|
|
|
|
|
|
|
Return user-readable string describing the given encoding.
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxFontMapper::GetEncodingFromName}\label{wxfontmappergetencodingfromname}
|
|
|
|
|
|
|
|
\func{static wxFontEncoding}{GetEncodingFromName}{\param{const wxString\& }{encoding}}
|
|
|
|
|
|
|
|
Return the encoding corresponding to the given internal name. This function is
|
|
|
|
the inverse of \helpref{GetEncodingName}{wxfontmappergetencodingname} and is
|
|
|
|
intentionally less general than
|
|
|
|
\helpref{CharsetToEncoding}{wxfontmappercharsettoencoding}, i.e. it doesn't
|
|
|
|
try to make any guesses nor ever asks the user. It is meant just as a way of
|
|
|
|
restoring objects previously serialized using
|
|
|
|
\helpref{GetEncodingName}{wxfontmappergetencodingname}.
|
|
|
|
|
|
|
|
|
2000-03-11 05:05:40 -05:00
|
|
|
\membersection{wxFontMapper::GetEncodingName}\label{wxfontmappergetencodingname}
|
|
|
|
|
|
|
|
\func{static wxString}{GetEncodingName}{\param{wxFontEncoding }{encoding}}
|
|
|
|
|
2000-03-14 19:21:49 -05:00
|
|
|
Return internal string identifier for the encoding (see also
|
2000-03-11 05:05:40 -05:00
|
|
|
\helpref{GetEncodingDescription()}{wxfontmappergetencodingdescription})
|
|
|
|
|
2004-04-11 06:40:04 -04:00
|
|
|
\wxheading{See also}
|
2000-03-11 05:05:40 -05:00
|
|
|
|
2004-04-11 06:40:04 -04:00
|
|
|
\helpref{GetEncodingFromName}{wxfontmappergetencodingfromname}
|
2000-03-11 05:05:40 -05:00
|
|
|
|
|
|
|
|
2003-06-22 18:20:40 -04:00
|
|
|
\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.
|
|
|
|
|
|
|
|
|
2004-04-11 06:40:04 -04:00
|
|
|
\membersection{wxFontMapper::IsEncodingAvailable}\label{wxfontmapperisencodingavailable}
|
|
|
|
|
|
|
|
\func{bool}{IsEncodingAvailable}{\param{wxFontEncoding }{encoding}, \param{const wxString\& }{facename = wxEmptyString}}
|
|
|
|
|
|
|
|
Check whether given encoding is available in given face or not.
|
|
|
|
If no facename is given, find {\it any} font in this encoding.
|
|
|
|
|
|
|
|
|
2000-03-11 05:05:40 -05:00
|
|
|
\membersection{wxFontMapper::SetDialogParent}\label{wxfontmappersetdialogparent}
|
|
|
|
|
|
|
|
\func{void}{SetDialogParent}{\param{wxWindow* }{parent}}
|
|
|
|
|
|
|
|
The parent window for modal dialogs.
|
|
|
|
|
2004-04-11 06:40:04 -04:00
|
|
|
|
2000-03-11 05:05:40 -05:00
|
|
|
\membersection{wxFontMapper::SetDialogTitle}\label{wxfontmappersetdialogtitle}
|
|
|
|
|
|
|
|
\func{void}{SetDialogTitle}{\param{const wxString\& }{title}}
|
|
|
|
|
|
|
|
The title for the dialogs (note that default is quite reasonable).
|
|
|
|
|
2004-04-11 06:40:04 -04:00
|
|
|
|
2002-04-06 10:04:27 -05:00
|
|
|
\membersection{wxFontMapper::Set}\label{wxfontmapperset}
|
|
|
|
|
|
|
|
\func{static wxFontMapper *}{Set}{\param{wxFontMapper *}{mapper}}
|
|
|
|
|
|
|
|
Set the current font mapper object and return previous one (may be NULL).
|
|
|
|
This method is only useful if you want to plug-in an alternative font mapper
|
2004-05-04 04:27:20 -04:00
|
|
|
into wxWidgets.
|
2002-04-06 10:04:27 -05:00
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxFontMapper::Get}{wxfontmapperget}
|
|
|
|
|
2004-04-11 06:40:04 -04:00
|
|
|
|
2000-03-11 05:05:40 -05:00
|
|
|
\membersection{wxFontMapper::SetConfig}\label{wxfontmappersetconfig}
|
|
|
|
|
|
|
|
\func{void}{SetConfig}{\param{wxConfigBase* }{config}}
|
|
|
|
|
|
|
|
Set the config object to use (may be NULL to use default).
|
|
|
|
|
|
|
|
By default, the global one (from wxConfigBase::Get() will be used)
|
|
|
|
and the default root path for the config settings is the string returned by
|
|
|
|
GetDefaultConfigPath().
|
|
|
|
|
2004-04-11 06:40:04 -04:00
|
|
|
|
2000-03-11 05:05:40 -05:00
|
|
|
\membersection{wxFontMapper::SetConfigPath}\label{wxfontmappersetconfigpath}
|
|
|
|
|
|
|
|
\func{void}{SetConfigPath}{\param{const wxString\& }{prefix}}
|
|
|
|
|
|
|
|
Set the root config path to use (should be an absolute path).
|
1999-11-04 15:43:52 -05:00
|
|
|
|