📄 fontmap.tex
字号:
%% automatically generated by HelpGen from% fontmap.h at 10/Mar/00 23:54:16%\section{\class{wxFontMapper}}\label{wxfontmapper}wxFontMapper manages user-definable correspondence between logical fontnames and the fonts present on the machine.The default implementations of all functions will ask the user if they arenot capable of finding the answer themselves and store the answer in aconfig file (configurable via SetConfigXXX functions). This behaviour maybe disabled by giving the value of false to "interactive" parameter.However, the functions will always consult the config file to allow theuser-defined values override the default logic and there is no way todisable this - which shouldn't be ever needed because if "interactive" wasnever true, the config file is never created anyhow.In case everything else fails (i.e. there is no record in config fileand "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 wxMBConv classes}If you need to display text in encoding which is not available athost 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{wxMBConv classes}{mbconvclasses}).Following code snippet demonstrates it:\begin{verbatim}if (!wxFontMapper::Get()->IsEncodingAvailable(enc, facename)){ wxFontEncoding alternative; if (wxFontMapper::Get()->GetAltForEncoding(enc, &alternative, facename, false)) { 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)...}...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}}}\membersection{wxFontMapper::wxFontMapper}\label{wxfontmapperwxfontmapper}\func{}{wxFontMapper}{\void}Default ctor.\wxheading{Note}The preferred way of creating a wxFontMapper instance is to call \helpref{wxFontMapper::Get}{wxfontmapperget}.\membersection{wxFontMapper::\destruct{wxFontMapper}}\label{wxfontmapperdtor}\func{}{\destruct{wxFontMapper}}{\void}Virtual dtor for a base class.\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 whichmay lead to unexpected reentrancies and may also take a significantly longertime than a simple function call. For these reasons, it is almost always a badidea to call this function from the event handlers for repeatedly generatedevents such as \texttt{EVT\_PAINT}.\membersection{wxFontMapper::Get}\label{wxfontmapperget}\func{static wxFontMapper *}{Get}{\void}Get the current font mapper object. If there is no current object, createsone.\wxheading{See also}\helpref{wxFontMapper::Set}{wxfontmapperset}\membersection{wxFontMapper::GetAllEncodingNames}\label{wxfontmappergetallencodingnames}\func{static const wxChar**}{GetAllEncodingNames}{\param{wxFontEncoding }{encoding}}Returns the array of all possible names for the given encoding. The array is\NULL-terminated. IF it isn't empty, the first name in it is the canonicalencoding name, i.e. the same string as returned by \helpref{GetEncodingName()}{wxfontmappergetencodingname}.\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{wxFontEncoding* }{alt\_encoding}, \param{const wxString\& }{facename = wxEmptyString}, \param{bool }{interactive = true}}Find an alternative for the given encoding (which is supposed to not beavailable on this system). If successful, return true and fill infostructure with the parameters required to create the font, otherwisereturn false.The first form is for wxWidgets' internal use while the second oneis better suitable for general use -- it returns wxFontEncoding whichcan consequently be passed to wxFont constructor.\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::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 isthe inverse of \helpref{GetEncodingName}{wxfontmappergetencodingname} and isintentionally less general than \helpref{CharsetToEncoding}{wxfontmappercharsettoencoding}, i.e. it doesn'ttry to make any guesses nor ever asks the user. It is meant just as a way ofrestoring objects previously serialized using \helpref{GetEncodingName}{wxfontmappergetencodingname}.\membersection{wxFontMapper::GetEncodingName}\label{wxfontmappergetencodingname}\func{static wxString}{GetEncodingName}{\param{wxFontEncoding }{encoding}}Return internal string identifier for the encoding (see also \helpref{GetEncodingDescription()}{wxfontmappergetencodingdescription})\wxheading{See also}\helpref{GetEncodingFromName}{wxfontmappergetencodingfromname}\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 getall supported encodings.\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.\membersection{wxFontMapper::SetDialogParent}\label{wxfontmappersetdialogparent}\func{void}{SetDialogParent}{\param{wxWindow* }{parent}}The parent window for modal dialogs.\membersection{wxFontMapper::SetDialogTitle}\label{wxfontmappersetdialogtitle}\func{void}{SetDialogTitle}{\param{const wxString\& }{title}}The title for the dialogs (note that default is quite reasonable).\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 mapperinto wxWidgets.\wxheading{See also}\helpref{wxFontMapper::Get}{wxfontmapperget}\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 byGetDefaultConfigPath().\membersection{wxFontMapper::SetConfigPath}\label{wxfontmappersetconfigpath}\func{void}{SetConfigPath}{\param{const wxString\& }{prefix}}Set the root config path to use (should be an absolute path).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -