]>
Commit | Line | Data |
---|---|---|
a660d684 KB |
1 | \section{\class{wxFont}}\label{wxfont} |
2 | ||
3 | A font is an object which determines the appearance of text. Fonts are | |
4 | used for drawing text to a device context, and setting the appearance of | |
5 | a window's text. | |
6 | ||
a95bfca7 RR |
7 | This class uses \helpref{reference counting and copy-on-write}{trefcount} |
8 | internally so that assignments between two instances of this class are very | |
9 | cheap. You can therefore use actual objects instead of pointers without | |
10 | efficiency problems. If an instance of this class is changed it will create | |
11 | its own data internally so that other instances, which previously shared the | |
12 | data using the reference counting, are not affected. | |
13 | ||
8161ba08 JS |
14 | You can retrieve the current system font settings with \helpref{wxSystemSettings}{wxsystemsettings}. |
15 | ||
16 | \helpref{wxSystemSettings}{wxsystemsettings} | |
17 | ||
a660d684 KB |
18 | \wxheading{Derived from} |
19 | ||
20 | \helpref{wxGDIObject}{wxgdiobject}\\ | |
21 | \helpref{wxObject}{wxobject} | |
22 | ||
954b8ae6 JS |
23 | \wxheading{Include files} |
24 | ||
25 | <wx/font.h> | |
26 | ||
a7af285d VZ |
27 | \wxheading{Library} |
28 | ||
29 | \helpref{wxCore}{librarieslist} | |
30 | ||
dccce9ea VZ |
31 | \wxheading{Constants} |
32 | ||
544229d1 | 33 | The possible values for the \arg{family} parameter of \helpref{wxFont |
b236c10f | 34 | constructor}{wxfontctor} are (the old names are for compatibility only): |
544229d1 VZ |
35 | |
36 | \begin{verbatim} | |
37 | enum wxFontFamily | |
38 | { | |
39 | wxFONTFAMILY_DEFAULT = wxDEFAULT, | |
40 | wxFONTFAMILY_DECORATIVE = wxDECORATIVE, | |
41 | wxFONTFAMILY_ROMAN = wxROMAN, | |
42 | wxFONTFAMILY_SCRIPT = wxSCRIPT, | |
43 | wxFONTFAMILY_SWISS = wxSWISS, | |
44 | wxFONTFAMILY_MODERN = wxMODERN, | |
45 | wxFONTFAMILY_TELETYPE = wxTELETYPE, | |
46 | wxFONTFAMILY_MAX | |
47 | }; | |
48 | \end{verbatim} | |
49 | ||
0f6858b6 RR |
50 | The possible values for the \arg{weight} parameter are (the old names |
51 | are for compatibility only): | |
52 | ||
53 | \begin{verbatim} | |
54 | enum wxFontWeight | |
55 | { | |
56 | wxFONTWEIGHT_NORMAL = wxNORMAL, | |
57 | wxFONTWEIGHT_LIGHT = wxLIGHT, | |
58 | wxFONTWEIGHT_BOLD = wxBOLD, | |
59 | wxFONTWEIGHT_MAX | |
60 | }; | |
61 | \end{verbatim} | |
62 | ||
01cb1c26 | 63 | The font flags which can be used during the font creation are: |
d2c2afc9 | 64 | |
01cb1c26 VZ |
65 | \begin{verbatim} |
66 | enum | |
67 | { | |
68 | // no special flags: font with default weight/slant/anti-aliasing | |
69 | wxFONTFLAG_DEFAULT = 0, | |
70 | ||
71 | // slant flags (default: no slant) | |
72 | wxFONTFLAG_ITALIC = 1 << 0, | |
73 | wxFONTFLAG_SLANT = 1 << 1, | |
74 | ||
75 | // weight flags (default: medium) | |
76 | wxFONTFLAG_LIGHT = 1 << 2, | |
77 | wxFONTFLAG_BOLD = 1 << 3, | |
78 | ||
79 | // anti-aliasing flag: force on or off (default: the current system default) | |
80 | wxFONTFLAG_ANTIALIASED = 1 << 4, | |
81 | wxFONTFLAG_NOT_ANTIALIASED = 1 << 5, | |
82 | ||
83 | // underlined/strikethrough flags (default: no lines) | |
84 | wxFONTFLAG_UNDERLINED = 1 << 6, | |
85 | wxFONTFLAG_STRIKETHROUGH = 1 << 7, | |
86 | }; | |
87 | \end{verbatim} | |
88 | ||
89 | The known font encodings are: | |
d2c2afc9 | 90 | |
dccce9ea VZ |
91 | \begin{verbatim} |
92 | enum wxFontEncoding | |
93 | { | |
94 | wxFONTENCODING_SYSTEM = -1, // system default | |
95 | wxFONTENCODING_DEFAULT, // current default encoding | |
96 | ||
97 | // ISO8859 standard defines a number of single-byte charsets | |
98 | wxFONTENCODING_ISO8859_1, // West European (Latin1) | |
99 | wxFONTENCODING_ISO8859_2, // Central and East European (Latin2) | |
100 | wxFONTENCODING_ISO8859_3, // Esperanto (Latin3) | |
101 | wxFONTENCODING_ISO8859_4, // Baltic (old) (Latin4) | |
102 | wxFONTENCODING_ISO8859_5, // Cyrillic | |
103 | wxFONTENCODING_ISO8859_6, // Arabic | |
104 | wxFONTENCODING_ISO8859_7, // Greek | |
105 | wxFONTENCODING_ISO8859_8, // Hebrew | |
106 | wxFONTENCODING_ISO8859_9, // Turkish (Latin5) | |
107 | wxFONTENCODING_ISO8859_10, // Variation of Latin4 (Latin6) | |
108 | wxFONTENCODING_ISO8859_11, // Thai | |
109 | wxFONTENCODING_ISO8859_12, // doesn't exist currently, but put it | |
110 | // here anyhow to make all ISO8859 | |
111 | // consecutive numbers | |
112 | wxFONTENCODING_ISO8859_13, // Baltic (Latin7) | |
113 | wxFONTENCODING_ISO8859_14, // Latin8 | |
114 | wxFONTENCODING_ISO8859_15, // Latin9 (a.k.a. Latin0, includes euro) | |
115 | wxFONTENCODING_ISO8859_MAX, | |
116 | ||
117 | // Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html) | |
118 | wxFONTENCODING_KOI8, // we don't support any of KOI8 variants | |
119 | wxFONTENCODING_ALTERNATIVE, // same as MS-DOS CP866 | |
120 | wxFONTENCODING_BULGARIAN, // used under Linux in Bulgaria | |
121 | ||
122 | // what would we do without Microsoft? They have their own encodings | |
123 | // for DOS | |
124 | wxFONTENCODING_CP437, // original MS-DOS codepage | |
125 | wxFONTENCODING_CP850, // CP437 merged with Latin1 | |
126 | wxFONTENCODING_CP852, // CP437 merged with Latin2 | |
127 | wxFONTENCODING_CP855, // another cyrillic encoding | |
128 | wxFONTENCODING_CP866, // and another one | |
129 | // and for Windows | |
130 | wxFONTENCODING_CP874, // WinThai | |
131 | wxFONTENCODING_CP1250, // WinLatin2 | |
132 | wxFONTENCODING_CP1251, // WinCyrillic | |
133 | wxFONTENCODING_CP1252, // WinLatin1 | |
134 | wxFONTENCODING_CP1253, // WinGreek (8859-7) | |
135 | wxFONTENCODING_CP1254, // WinTurkish | |
136 | wxFONTENCODING_CP1255, // WinHebrew | |
137 | wxFONTENCODING_CP1256, // WinArabic | |
138 | wxFONTENCODING_CP1257, // WinBaltic (same as Latin 7) | |
139 | wxFONTENCODING_CP12_MAX, | |
140 | ||
141 | wxFONTENCODING_UTF7, // UTF-7 Unicode encoding | |
142 | wxFONTENCODING_UTF8, // UTF-8 Unicode encoding | |
143 | ||
144 | wxFONTENCODING_UNICODE, // Unicode - currently used only by | |
145 | // wxEncodingConverter class | |
146 | ||
147 | wxFONTENCODING_MAX | |
148 | }; | |
149 | \end{verbatim} | |
150 | ||
20e85460 JS |
151 | \wxheading{Predefined objects} |
152 | ||
153 | Objects: | |
154 | ||
155 | {\bf wxNullFont} | |
156 | ||
157 | Pointers: | |
158 | ||
159 | {\bf wxNORMAL\_FONT\\ | |
160 | wxSMALL\_FONT\\ | |
161 | wxITALIC\_FONT\\ | |
162 | wxSWISS\_FONT} | |
163 | ||
a660d684 KB |
164 | \wxheading{See also} |
165 | ||
166 | \helpref{wxFont overview}{wxfontoverview}, \helpref{wxDC::SetFont}{wxdcsetfont},\rtfsp | |
167 | \helpref{wxDC::DrawText}{wxdcdrawtext}, \helpref{wxDC::GetTextExtent}{wxdcgettextextent},\rtfsp | |
8161ba08 | 168 | \helpref{wxFontDialog}{wxfontdialog}, \helpref{wxSystemSettings}{wxsystemsettings} |
a660d684 KB |
169 | |
170 | \latexignore{\rtfignore{\wxheading{Members}}} | |
171 | ||
544229d1 | 172 | |
b236c10f | 173 | \membersection{wxFont::wxFont}\label{wxfontctor} |
a660d684 KB |
174 | |
175 | \func{}{wxFont}{\void} | |
176 | ||
177 | Default constructor. | |
178 | ||
a91225b2 RR |
179 | \func{}{wxFont}{\param{const wxFont\&}{ font}} |
180 | ||
181 | Copy constructor, uses \helpref{reference counting}{trefcount}. | |
182 | ||
0f6858b6 | 183 | \func{}{wxFont}{\param{int}{ pointSize}, \param{wxFontFamily}{ family}, \param{int}{ style}, \param{wxFontWeight}{ weight}, |
544229d1 VZ |
184 | \param{const bool}{ underline = false}, \param{const wxString\& }{faceName = ""}, |
185 | \param{wxFontEncoding }{encoding = wxFONTENCODING\_DEFAULT}} | |
186 | ||
9475f9e7 | 187 | \func{}{wxFont}{\param{const wxSize\&}{ pixelSize}, \param{wxFontFamily}{ family}, \param{int}{ style}, \param{wxFontWeight}{ weight}, |
cc81d32f | 188 | \param{const bool}{ underline = false}, \param{const wxString\& }{faceName = ""}, |
0c5d3e1c | 189 | \param{wxFontEncoding }{encoding = wxFONTENCODING\_DEFAULT}} |
a660d684 | 190 | |
544229d1 | 191 | Creates a font object with the specified attributes. |
a660d684 KB |
192 | |
193 | \wxheading{Parameters} | |
194 | ||
195 | \docparam{pointSize}{Size in points.} | |
196 | ||
544229d1 VZ |
197 | \docparam{pixelSize}{Size in pixels: this is directly supported only under MSW |
198 | currently where this constructor can be used directly, under other platforms a | |
199 | font with the closest size to the given one is found using binary search and | |
200 | the static \helpref{New}{wxfontnew} method must be used.} | |
201 | ||
a660d684 KB |
202 | \docparam{family}{Font family, a generic way of referring to fonts without specifying actual facename. One of: |
203 | ||
204 | \twocolwidtha{5cm} | |
205 | \begin{twocollist}\itemsep=0pt | |
0f6858b6 RR |
206 | \twocolitem{{\bf wxFONTFAMILY\_DEFAULT}}{Chooses a default font.} |
207 | \twocolitem{{\bf wxFONTFAMILY\_DECORATIVE}}{A decorative font.} | |
208 | \twocolitem{{\bf wxFONTFAMILY\_ROMAN}}{A formal, serif font.} | |
209 | \twocolitem{{\bf wxFONTFAMILY\_SCRIPT}}{A handwriting font.} | |
210 | \twocolitem{{\bf wxFONTFAMILY\_SWISS}}{A sans-serif font.} | |
211 | \twocolitem{{\bf wxFONTFAMILY\_MODERN}}{A fixed pitch font.} | |
212 | \twocolitem{{\bf wxFONTFAMILY\_TELETYPE}}{A teletype font.} | |
a660d684 KB |
213 | \end{twocollist}} |
214 | ||
0f6858b6 RR |
215 | \docparam{style}{One of {\bf wxFONTSTYLE\_NORMAL}, {\bf wxFONTSTYLE\_SLANT} and {\bf wxFONTSTYLE\_ITALIC}.} |
216 | ||
217 | \docparam{weight}{Font weight, sometimes also referred to as font boldness. One of: | |
a660d684 | 218 | |
0f6858b6 RR |
219 | \twocolwidtha{5cm} |
220 | \begin{twocollist}\itemsep=0pt | |
221 | \twocolitem{{\bf wxFONTWEIGHT\_NORMAL}}{Normal font.} | |
222 | \twocolitem{{\bf wxFONTWEIGHT\_LIGHT}}{Light font.} | |
223 | \twocolitem{{\bf wxFONTWEIGHT\_BOLD}}{Bold font.} | |
224 | \end{twocollist}} | |
a660d684 | 225 | |
da494b40 | 226 | \docparam{underline}{The value can be true or false. At present this has an effect on Windows and Motif 2.x only.} |
a660d684 | 227 | |
3980000c RR |
228 | \docparam{faceName}{An optional string specifying the actual typeface to be used. If it is an empty string, |
229 | a default typeface will be chosen based on the family.} | |
a660d684 | 230 | |
0c5d3e1c VZ |
231 | \docparam{encoding}{An encoding which may be one of |
232 | \twocolwidtha{5cm} | |
233 | \begin{twocollist}\itemsep=0pt | |
234 | \twocolitem{{\bf wxFONTENCODING\_SYSTEM}}{Default system encoding.} | |
235 | \twocolitem{{\bf wxFONTENCODING\_DEFAULT}}{Default application encoding: this | |
0f6858b6 | 236 | is the encoding set by calls to |
88b1927c | 237 | \helpref{SetDefaultEncoding}{wxfontsetdefaultencoding} and which may be set to, |
0c5d3e1c VZ |
238 | say, KOI8 to create all fonts by default with KOI8 encoding. Initially, the |
239 | default application encoding is the same as default system encoding.} | |
240 | \twocolitem{{\bf wxFONTENCODING\_ISO8859\_1...15}}{ISO8859 encodings.} | |
2edb0bde | 241 | \twocolitem{{\bf wxFONTENCODING\_KOI8}}{The standard Russian encoding for Internet.} |
0c5d3e1c VZ |
242 | \twocolitem{{\bf wxFONTENCODING\_CP1250...1252}}{Windows encodings similar to ISO8859 (but not identical).} |
243 | \end{twocollist} | |
544229d1 VZ |
244 | If the specified encoding isn't available, no font is created |
245 | (see also \helpref{font encoding overview}{wxfontencodingoverview}). | |
0c5d3e1c VZ |
246 | } |
247 | ||
a660d684 KB |
248 | \wxheading{Remarks} |
249 | ||
250 | If the desired font does not exist, the closest match will be chosen. | |
2edb0bde | 251 | Under Windows, only scalable TrueType fonts are used. |
a660d684 | 252 | |
a660d684 KB |
253 | See also \helpref{wxDC::SetFont}{wxdcsetfont}, \helpref{wxDC::DrawText}{wxdcdrawtext} |
254 | and \helpref{wxDC::GetTextExtent}{wxdcgettextextent}. | |
255 | ||
544229d1 | 256 | |
b236c10f | 257 | \membersection{wxFont::\destruct{wxFont}}\label{wxfontdtor} |
a660d684 KB |
258 | |
259 | \func{}{\destruct{wxFont}}{\void} | |
260 | ||
261 | Destructor. | |
55ccdb93 | 262 | See \helpref{reference-counted object destruction}{refcountdestruct} for more info. |
a660d684 KB |
263 | |
264 | \wxheading{Remarks} | |
265 | ||
a660d684 KB |
266 | Although all remaining fonts are deleted when the application exits, |
267 | the application should try to clean up all fonts itself. This is because | |
fc2171bd | 268 | wxWidgets cannot know if a pointer to the font object is stored in an |
a660d684 KB |
269 | application data structure, and there is a risk of double deletion. |
270 | ||
544229d1 | 271 | |
53f6aab7 VZ |
272 | \membersection{wxFont::IsFixedWidth}\label{wxfontisfixedwidth} |
273 | ||
274 | \constfunc{bool}{IsFixedWidth}{\void} | |
275 | ||
0f6858b6 | 276 | Returns {\tt true} if the font is a fixed width (or monospaced) font, |
cc81d32f | 277 | {\tt false} if it is a proportional one or font is invalid. |
53f6aab7 | 278 | |
544229d1 | 279 | |
775a998e VZ |
280 | \membersection{wxFont::GetDefaultEncoding}\label{wxfontgetdefaultencoding} |
281 | ||
282 | \func{static wxFontEncoding}{GetDefaultEncoding}{\void} | |
283 | ||
2b5f62a0 | 284 | Returns the current application's default encoding. |
775a998e VZ |
285 | |
286 | \wxheading{See also} | |
287 | ||
0f6858b6 | 288 | \helpref{Font encoding overview}{wxfontencodingoverview}, |
775a998e VZ |
289 | \helpref{SetDefaultEncoding}{wxfontsetdefaultencoding} |
290 | ||
544229d1 | 291 | |
a660d684 KB |
292 | \membersection{wxFont::GetFaceName}\label{wxfontgetfacename} |
293 | ||
294 | \constfunc{wxString}{GetFaceName}{\void} | |
295 | ||
296 | Returns the typeface name associated with the font, or the empty string if there is no | |
297 | typeface information. | |
298 | ||
299 | \wxheading{See also} | |
300 | ||
301 | \helpref{wxFont::SetFaceName}{wxfontsetfacename} | |
302 | ||
544229d1 | 303 | |
a660d684 KB |
304 | \membersection{wxFont::GetFamily}\label{wxfontgetfamily} |
305 | ||
0f6858b6 | 306 | \constfunc{wxFontFamily}{GetFamily}{\void} |
a660d684 | 307 | |
0f6858b6 | 308 | Gets the font family. See \helpref{wxFont::SetFamily}{wxfontsetfamily} for a list of valid |
a660d684 KB |
309 | family identifiers. |
310 | ||
311 | \wxheading{See also} | |
312 | ||
313 | \helpref{wxFont::SetFamily}{wxfontsetfamily} | |
314 | ||
544229d1 | 315 | |
dccb75b6 | 316 | \membersection{wxFont::GetNativeFontInfoDesc}\label{wxfontgetnativefontinfodesc} |
a660d684 | 317 | |
dccb75b6 | 318 | \constfunc{wxString}{GetNativeFontInfoDesc}{\void} |
a660d684 | 319 | |
85ab460e VZ |
320 | Returns the platform-dependent string completely describing this font. |
321 | Returned string is always non-empty. | |
f0545c14 VZ |
322 | Note that the returned string is not meant to be shown or edited by the user: a typical |
323 | use of this function is for serializing in string-form a wxFont object. | |
dccb75b6 VZ |
324 | |
325 | \wxheading{See also} | |
326 | ||
f0545c14 VZ |
327 | \helpref{wxFont::SetNativeFontInfo}{wxfontsetnativefontinfo},\helpref{wxFont::GetNativeFontInfoUserDesc}{wxfontgetnativefontinfouserdesc} |
328 | ||
329 | ||
330 | \membersection{wxFont::GetNativeFontInfoUserDesc}\label{wxfontgetnativefontinfouserdesc} | |
331 | ||
332 | \func{wxString}{GetNativeFontInfoUserDesc}{\void} | |
333 | ||
85ab460e VZ |
334 | Returns a user-friendly string for this font object. Returned string is always non-empty. |
335 | Some examples of the formats of returned strings (which are platform-dependent) are in \helpref{SetNativeFontInfoUserDesc}{wxfontsetnativefontinfouserdesc}. | |
f0545c14 VZ |
336 | |
337 | \wxheading{See also} | |
338 | ||
339 | \helpref{wxFont::GetNativeFontInfoDesc}{wxfontgetnativefontinfodesc} | |
a660d684 | 340 | |
544229d1 | 341 | |
a660d684 KB |
342 | \membersection{wxFont::GetPointSize}\label{wxfontgetpointsize} |
343 | ||
344 | \constfunc{int}{GetPointSize}{\void} | |
345 | ||
346 | Gets the point size. | |
347 | ||
348 | \wxheading{See also} | |
349 | ||
350 | \helpref{wxFont::SetPointSize}{wxfontsetpointsize} | |
351 | ||
544229d1 | 352 | |
a660d684 KB |
353 | \membersection{wxFont::GetStyle}\label{wxfontgetstyle} |
354 | ||
355 | \constfunc{int}{GetStyle}{\void} | |
356 | ||
b236c10f | 357 | Gets the font style. See \helpref{wxFont::wxFont}{wxfontctor} for a list of valid |
a660d684 KB |
358 | styles. |
359 | ||
360 | \wxheading{See also} | |
361 | ||
362 | \helpref{wxFont::SetStyle}{wxfontsetstyle} | |
363 | ||
544229d1 | 364 | |
a660d684 KB |
365 | \membersection{wxFont::GetUnderlined}\label{wxfontgetunderlined} |
366 | ||
367 | \constfunc{bool}{GetUnderlined}{\void} | |
368 | ||
cc81d32f | 369 | Returns true if the font is underlined, false otherwise. |
a660d684 KB |
370 | |
371 | \wxheading{See also} | |
372 | ||
373 | \helpref{wxFont::SetUnderlined}{wxfontsetunderlined} | |
374 | ||
544229d1 | 375 | |
a660d684 KB |
376 | \membersection{wxFont::GetWeight}\label{wxfontgetweight} |
377 | ||
0f6858b6 | 378 | \constfunc{wxFontWeight}{GetWeight}{\void} |
a660d684 | 379 | |
b236c10f | 380 | Gets the font weight. See \helpref{wxFont::wxFont}{wxfontctor} for a list of valid |
a660d684 KB |
381 | weight identifiers. |
382 | ||
383 | \wxheading{See also} | |
384 | ||
385 | \helpref{wxFont::SetWeight}{wxfontsetweight} | |
386 | ||
544229d1 VZ |
387 | |
388 | \membersection{wxFont::New}\label{wxfontnew} | |
389 | ||
0f6858b6 | 390 | \func{static wxFont *}{New}{\param{int}{ pointSize}, \param{wxFontFamily}{ family}, \param{int}{ style}, \param{wxFontWeight}{ weight}, |
544229d1 VZ |
391 | \param{const bool}{ underline = false}, \param{const wxString\& }{faceName = ""}, |
392 | \param{wxFontEncoding }{encoding = wxFONTENCODING\_DEFAULT}} | |
393 | ||
0f6858b6 | 394 | \func{static wxFont *}{New}{\param{int}{ pointSize}, \param{wxFontFamily}{ family}, |
544229d1 VZ |
395 | \param{int}{ flags = \texttt{wxFONTFLAG\_DEFAULT}}, \param{const wxString\& }{faceName = ""}, |
396 | \param{wxFontEncoding }{encoding = wxFONTENCODING\_DEFAULT}} | |
397 | ||
0f6858b6 | 398 | \func{static wxFont *}{New}{\param{const wxSize\&}{ pixelSize}, \param{wxFontFamily}{ family}, \param{int}{ style}, \param{wxFontWeight}{ weight}, |
544229d1 VZ |
399 | \param{const bool}{ underline = false}, \param{const wxString\& }{faceName = ""}, |
400 | \param{wxFontEncoding }{encoding = wxFONTENCODING\_DEFAULT}} | |
401 | ||
0f6858b6 | 402 | \func{static wxFont *}{New}{\param{const wxSize\&}{ pixelSize}, \param{wxFontFamily}{ family}, |
544229d1 VZ |
403 | \param{int}{ flags = \texttt{wxFONTFLAG\_DEFAULT}}, \param{const wxString\& }{faceName = ""}, |
404 | \param{wxFontEncoding }{encoding = wxFONTENCODING\_DEFAULT}} | |
405 | ||
406 | These functions take the same parameters as \helpref{wxFont | |
b236c10f | 407 | constructor}{wxfontctor} and return a new font object allocated on the heap. |
544229d1 VZ |
408 | |
409 | Using \texttt{New()} is currently the only way to directly create a font with | |
410 | the given size in pixels on platforms other than wxMSW. | |
411 | ||
412 | ||
b7cacb43 | 413 | \membersection{wxFont::IsOk}\label{wxfontisok} |
8a280d9a | 414 | |
b7cacb43 | 415 | \constfunc{bool}{IsOk}{\void} |
8a280d9a | 416 | |
cc81d32f | 417 | Returns {\tt true} if this object is a valid font, {\tt false} otherwise. |
8a280d9a | 418 | |
544229d1 | 419 | |
88b1927c JS |
420 | \membersection{wxFont::SetDefaultEncoding}\label{wxfontsetdefaultencoding} |
421 | ||
422 | \func{static void}{SetDefaultEncoding}{\param{wxFontEncoding }{encoding}} | |
423 | ||
424 | Sets the default font encoding. | |
425 | ||
775a998e VZ |
426 | \wxheading{See also} |
427 | ||
0f6858b6 | 428 | \helpref{Font encoding overview}{wxfontencodingoverview}, |
775a998e VZ |
429 | \helpref{GetDefaultEncoding}{wxfontgetdefaultencoding} |
430 | ||
544229d1 | 431 | |
a660d684 KB |
432 | \membersection{wxFont::SetFaceName}\label{wxfontsetfacename} |
433 | ||
85ab460e | 434 | \func{bool}{SetFaceName}{\param{const wxString\& }{faceName}} |
a660d684 KB |
435 | |
436 | Sets the facename for the font. | |
85ab460e | 437 | Returns \true if the given face name exists; \false otherwise. |
a660d684 KB |
438 | |
439 | \wxheading{Parameters} | |
440 | ||
441 | \docparam{faceName}{A valid facename, which should be on the end-user's system.} | |
442 | ||
443 | \wxheading{Remarks} | |
444 | ||
445 | To avoid portability problems, don't rely on a specific face, but specify the font family | |
446 | instead or as well. A suitable font will be found on the end-user's system. If both the | |
fc2171bd | 447 | family and the facename are specified, wxWidgets will first search for the specific face, |
a660d684 KB |
448 | and then for a font belonging to the same family. |
449 | ||
450 | \wxheading{See also} | |
451 | ||
452 | \helpref{wxFont::GetFaceName}{wxfontgetfacename}, \helpref{wxFont::SetFamily}{wxfontsetfamily} | |
453 | ||
544229d1 | 454 | |
a660d684 KB |
455 | \membersection{wxFont::SetFamily}\label{wxfontsetfamily} |
456 | ||
0f6858b6 | 457 | \func{void}{SetFamily}{\param{wxFontFamily}{ family}} |
a660d684 KB |
458 | |
459 | Sets the font family. | |
460 | ||
461 | \wxheading{Parameters} | |
462 | ||
463 | \docparam{family}{One of: | |
464 | ||
465 | \twocolwidtha{5cm} | |
466 | \begin{twocollist}\itemsep=0pt | |
0f6858b6 RR |
467 | \twocolitem{{\bf wxFONTFAMILY\_DEFAULT}}{Chooses a default font.} |
468 | \twocolitem{{\bf wxFONTFAMILY\_DECORATIVE}}{A decorative font.} | |
469 | \twocolitem{{\bf wxFONTFAMILY\_ROMAN}}{A formal, serif font.} | |
470 | \twocolitem{{\bf wxFONTFAMILY\_SCRIPT}}{A handwriting font.} | |
471 | \twocolitem{{\bf wxFONTFAMILY\_SWISS}}{A sans-serif font.} | |
472 | \twocolitem{{\bf wxFONTFAMILY\_MODERN}}{A fixed pitch font.} | |
473 | \twocolitem{{\bf wxFONTFAMILY\_TELETYPE}}{A teletype font.} | |
a660d684 KB |
474 | \end{twocollist}} |
475 | ||
476 | \wxheading{See also} | |
477 | ||
478 | \helpref{wxFont::GetFamily}{wxfontgetfamily}, \helpref{wxFont::SetFaceName}{wxfontsetfacename} | |
479 | ||
544229d1 | 480 | |
dccb75b6 VZ |
481 | \membersection{wxFont::SetNativeFontInfo}\label{wxfontsetnativefontinfo} |
482 | ||
85ab460e | 483 | \func{bool}{SetNativeFontInfo}{\param{const wxString\& }{info}} |
dccb75b6 | 484 | |
85ab460e VZ |
485 | Creates the font corresponding to the given native font description string and returns \true if |
486 | the creation was successful. | |
0f6858b6 | 487 | which must have been previously returned by |
dccb75b6 | 488 | \helpref{GetNativeFontInfoDesc}{wxfontgetnativefontinfodesc}. If the string is |
f0545c14 VZ |
489 | invalid, font is unchanged. This function is typically used for de-serializing a wxFont |
490 | object previously saved in a string-form. | |
491 | ||
492 | \wxheading{See also} | |
493 | ||
494 | \helpref{wxFont::SetNativeFontInfoUserDesc}{wxfontsetnativefontinfouserdesc} | |
495 | ||
496 | ||
497 | \membersection{wxFont::SetNativeFontInfoUserDesc}\label{wxfontsetnativefontinfouserdesc} | |
498 | ||
85ab460e | 499 | \func{bool}{SetNativeFontInfoUserDesc}{\param{const wxString\& }{info}} |
f0545c14 | 500 | |
85ab460e VZ |
501 | Creates the font corresponding to the given native font description string and returns \true if |
502 | the creation was successful. | |
f0545c14 VZ |
503 | Unlike \helpref{SetNativeFontInfo}{wxfontsetnativefontinfo}, this function accepts |
504 | strings which are user-friendly. | |
505 | Examples of accepted string formats are: | |
506 | ||
507 | \twocolwidtha{15cm} | |
508 | \begin{twocollist}\itemsep=0pt | |
509 | \twocolitem{Generic syntax}{Example} | |
510 | \twocolitem{on {\bf wxGTK2}: {\tt $[FACE-NAME]$ $[bold]$ $[oblique|italic]$ $[POINTSIZE]$}}{Monospace bold 10} | |
511 | \twocolitem{on {\bf wxMSW}: {\tt $[light|bold]$ $[italic]$ $[FACE-NAME]$ $[POINTSIZE]$ $[ENCODING]$}}{Tahoma 10 WINDOWS-1252} | |
512 | \twocolitem{on {\bf wxMac}: FIXME}{FIXME} | |
513 | \end{twocollist} | |
514 | ||
669b0c0a | 515 | For more detailed information about the allowed syntaxes you can look at the documentation of the native API used for font-rendering (e.g. \urlref{pango\_font\_description\_from\_string}{http://developer.gnome.org/doc/API/2.0/pango/pango-Fonts.html\#pango-font-description-from-string}). |
f0545c14 VZ |
516 | |
517 | \wxheading{See also} | |
518 | ||
519 | \helpref{wxFont::SetNativeFontInfo}{wxfontsetnativefontinfo} | |
520 | ||
dccb75b6 | 521 | |
544229d1 | 522 | |
a660d684 KB |
523 | \membersection{wxFont::SetPointSize}\label{wxfontsetpointsize} |
524 | ||
eaaa6a06 | 525 | \func{void}{SetPointSize}{\param{int}{ pointSize}} |
a660d684 KB |
526 | |
527 | Sets the point size. | |
528 | ||
529 | \wxheading{Parameters} | |
530 | ||
531 | \docparam{pointSize}{Size in points.} | |
532 | ||
533 | \wxheading{See also} | |
534 | ||
535 | \helpref{wxFont::GetPointSize}{wxfontgetpointsize} | |
536 | ||
544229d1 | 537 | |
a660d684 KB |
538 | \membersection{wxFont::SetStyle}\label{wxfontsetstyle} |
539 | ||
eaaa6a06 | 540 | \func{void}{SetStyle}{\param{int}{ style}} |
a660d684 KB |
541 | |
542 | Sets the font style. | |
543 | ||
544 | \wxheading{Parameters} | |
545 | ||
0f6858b6 | 546 | \docparam{style}{One of {\bf wxFONTSTYLE\_NORMAL}, {\bf wxFONTSTYLE\_SLANT} and {\bf wxFONTSTYLE\_ITALIC}.} |
a660d684 KB |
547 | |
548 | \wxheading{See also} | |
549 | ||
550 | \helpref{wxFont::GetStyle}{wxfontgetstyle} | |
551 | ||
544229d1 | 552 | |
a660d684 KB |
553 | \membersection{wxFont::SetUnderlined}\label{wxfontsetunderlined} |
554 | ||
555 | \func{void}{SetUnderlined}{\param{const bool}{ underlined}} | |
556 | ||
557 | Sets underlining. | |
558 | ||
559 | \wxheading{Parameters} | |
560 | ||
cc81d32f | 561 | \docparam{underlining}{true to underline, false otherwise.} |
a660d684 KB |
562 | |
563 | \wxheading{See also} | |
564 | ||
565 | \helpref{wxFont::GetUnderlined}{wxfontgetunderlined} | |
566 | ||
544229d1 | 567 | |
a660d684 KB |
568 | \membersection{wxFont::SetWeight}\label{wxfontsetweight} |
569 | ||
0f6858b6 | 570 | \func{void}{SetWeight}{\param{wxFontWeight}{ weight}} |
a660d684 KB |
571 | |
572 | Sets the font weight. | |
573 | ||
574 | \wxheading{Parameters} | |
575 | ||
0f6858b6 RR |
576 | \docparam{weight}{One of: |
577 | ||
578 | \twocolwidtha{5cm} | |
579 | \begin{twocollist}\itemsep=0pt | |
580 | \twocolitem{{\bf wxFONTWEIGHT\_NORMAL}}{Normal font.} | |
581 | \twocolitem{{\bf wxFONTWEIGHT\_LIGHT}}{Light font.} | |
582 | \twocolitem{{\bf wxFONTWEIGHT\_BOLD}}{Bold font.} | |
583 | \end{twocollist}} | |
a660d684 KB |
584 | |
585 | \wxheading{See also} | |
586 | ||
587 | \helpref{wxFont::GetWeight}{wxfontgetweight} | |
588 | ||
544229d1 | 589 | |
a660d684 KB |
590 | \membersection{wxFont::operator $=$}\label{wxfontassignment} |
591 | ||
592 | \func{wxFont\&}{operator $=$}{\param{const wxFont\& }{font}} | |
593 | ||
a91225b2 | 594 | Assignment operator, using \helpref{reference counting}{trefcount}. |
a660d684 | 595 | |
544229d1 | 596 | |
a660d684 KB |
597 | \membersection{wxFont::operator $==$}\label{wxfontequals} |
598 | ||
599 | \func{bool}{operator $==$}{\param{const wxFont\& }{font}} | |
600 | ||
55ccdb93 VZ |
601 | Equality operator. |
602 | See \helpref{reference-counted object comparison}{refcountequality} for more info. | |
a660d684 | 603 | |
544229d1 | 604 | |
a660d684 KB |
605 | \membersection{wxFont::operator $!=$}\label{wxfontnotequals} |
606 | ||
607 | \func{bool}{operator $!=$}{\param{const wxFont\& }{font}} | |
608 | ||
55ccdb93 VZ |
609 | Inequality operator. |
610 | See \helpref{reference-counted object comparison}{refcountequality} for more info. | |
a660d684 | 611 |