]>
Commit | Line | Data |
---|---|---|
1 | % | |
2 | % automatically generated by HelpGen from | |
3 | % fontmap.h at 10/Mar/00 23:54:16 | |
4 | % | |
5 | ||
6 | \section{\class{wxFontMapper}}\label{wxfontmapper} | |
7 | ||
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 | |
14 | be disabled by giving the value of FALSE to "interactive" parameter. | |
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 | |
19 | never TRUE, the config file is never created anyhow. | |
20 | ||
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. | |
25 | ||
26 | \wxheading{Global variables} | |
27 | ||
28 | {\tt wxFontMapper *wxTheFontMapper} is defined. | |
29 | ||
30 | \wxheading{Using wxFontMapper in conjunction with wxEncodingConverter} | |
31 | ||
32 | If you need to display text in encoding which is not available at | |
33 | host system (see \helpref{IsEncodingAvailable}{wxfontmapperisencodingavailable}), | |
34 | you may use these two classes to find font in some similar encoding | |
35 | (see \helpref{GetAltForEncoding}{wxfontmappergetaltforencoding}) | |
36 | and convert the text to this encoding | |
37 | (\helpref{wxEncodingConverter::Convert}{wxencodingconverterconvert}). | |
38 | ||
39 | Following code snippet demonstrates it: | |
40 | ||
41 | \begin{verbatim} | |
42 | if (!wxTheFontMapper->IsEncodingAvailable(enc, facename)) | |
43 | { | |
44 | wxFontEncoding alternative; | |
45 | if (wxTheFontMapper->GetAltForEncoding(enc, &alternative, | |
46 | facename, FALSE)) | |
47 | { | |
48 | wxEncodingConverter encconv; | |
49 | if (!encconv.Init(enc, alternative)) | |
50 | ...failure... | |
51 | else | |
52 | text = encconv.Convert(text); | |
53 | } | |
54 | else | |
55 | ...failure (or we may try iso8859-1/7bit ASCII)... | |
56 | } | |
57 | ...display text... | |
58 | \end{verbatim} | |
59 | ||
60 | ||
61 | \wxheading{Derived from} | |
62 | ||
63 | No base class | |
64 | ||
65 | \wxheading{Include files} | |
66 | ||
67 | <wx/fontmap.h> | |
68 | ||
69 | \wxheading{See also} | |
70 | ||
71 | \helpref{wxEncodingConverter}{wxencodingconverter}, | |
72 | \helpref{Writing non-English applications}{nonenglishoverview} | |
73 | ||
74 | \latexignore{\rtfignore{\wxheading{Members}}} | |
75 | ||
76 | \membersection{wxFontMapper::wxFontMapper}\label{wxfontmapperwxfontmapper} | |
77 | ||
78 | \func{}{wxFontMapper}{\void} | |
79 | ||
80 | Default ctor. | |
81 | ||
82 | \membersection{wxFontMapper::\destruct{wxFontMapper}}\label{wxfontmapperdtor} | |
83 | ||
84 | \func{}{\destruct{wxFontMapper}}{\void} | |
85 | ||
86 | Virtual dtor for a base class. | |
87 | ||
88 | \membersection{wxFontMapper::GetAltForEncoding}\label{wxfontmappergetaltforencoding} | |
89 | ||
90 | \func{bool}{GetAltForEncoding}{\param{wxFontEncoding }{encoding}, \param{wxNativeEncodingInfo* }{info}, \param{const wxString\& }{facename = wxEmptyString}, \param{bool }{interactive = TRUE}} | |
91 | ||
92 | \func{bool}{GetAltForEncoding}{\param{wxFontEncoding }{encoding}, \param{wxFontEncoding* }{alt\_encoding}, \param{const wxString\& }{facename = wxEmptyString}, \param{bool }{interactive = TRUE}} | |
93 | ||
94 | Find an alternative for the given encoding (which is supposed to not be | |
95 | available on this system). If successful, return TRUE and fill info | |
96 | structure with the parameters required to create the font, otherwise | |
97 | return FALSE. | |
98 | ||
99 | The first form is for wxWindows' internal use while the second one | |
100 | is better suitable for general use -- it returns wxFontEncoding which | |
101 | can consequently be passed to wxFont constructor. | |
102 | ||
103 | \membersection{wxFontMapper::IsEncodingAvailable}\label{wxfontmapperisencodingavailable} | |
104 | ||
105 | \func{bool}{IsEncodingAvailable}{\param{wxFontEncoding }{encoding}, \param{const wxString\& }{facename = wxEmptyString}} | |
106 | ||
107 | Check whether given encoding is available in given face or not. | |
108 | If no facename is given, find {\it any} font in this encoding. | |
109 | ||
110 | \membersection{wxFontMapper::CharsetToEncoding}\label{wxfontmappercharsettoencoding} | |
111 | ||
112 | \func{wxFontEncoding}{CharsetToEncoding}{\param{const wxString\& }{charset}, \param{bool }{interactive = TRUE}} | |
113 | ||
114 | Returns the encoding for the given charset (in the form of RFC 2046) or | |
115 | wxFONTENCODING\_SYSTEM if couldn't decode it. | |
116 | ||
117 | \membersection{wxFontMapper::GetEncodingName}\label{wxfontmappergetencodingname} | |
118 | ||
119 | \func{static wxString}{GetEncodingName}{\param{wxFontEncoding }{encoding}} | |
120 | ||
121 | Return internal string identifier for the encoding (see also | |
122 | \helpref{GetEncodingDescription()}{wxfontmappergetencodingdescription}) | |
123 | ||
124 | \membersection{wxFontMapper::GetEncodingDescription}\label{wxfontmappergetencodingdescription} | |
125 | ||
126 | \func{static wxString}{GetEncodingDescription}{\param{wxFontEncoding }{encoding}} | |
127 | ||
128 | Return user-readable string describing the given encoding. | |
129 | ||
130 | \membersection{wxFontMapper::SetDialogParent}\label{wxfontmappersetdialogparent} | |
131 | ||
132 | \func{void}{SetDialogParent}{\param{wxWindow* }{parent}} | |
133 | ||
134 | The parent window for modal dialogs. | |
135 | ||
136 | \membersection{wxFontMapper::SetDialogTitle}\label{wxfontmappersetdialogtitle} | |
137 | ||
138 | \func{void}{SetDialogTitle}{\param{const wxString\& }{title}} | |
139 | ||
140 | The title for the dialogs (note that default is quite reasonable). | |
141 | ||
142 | \membersection{wxFontMapper::SetConfig}\label{wxfontmappersetconfig} | |
143 | ||
144 | \func{void}{SetConfig}{\param{wxConfigBase* }{config}} | |
145 | ||
146 | Set the config object to use (may be NULL to use default). | |
147 | ||
148 | By default, the global one (from wxConfigBase::Get() will be used) | |
149 | and the default root path for the config settings is the string returned by | |
150 | GetDefaultConfigPath(). | |
151 | ||
152 | \membersection{wxFontMapper::SetConfigPath}\label{wxfontmappersetconfigpath} | |
153 | ||
154 | \func{void}{SetConfigPath}{\param{const wxString\& }{prefix}} | |
155 | ||
156 | Set the root config path to use (should be an absolute path). | |
157 |