]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/font.h
Remove never implemented wxDateTime::IsGregorianDate().
[wxWidgets.git] / interface / wx / font.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: font.h
e54c96f1 3// Purpose: interface of wxFont
23324ae1 4// Author: wxWidgets team
526954c5 5// Licence: wxWindows licence
23324ae1
FM
6/////////////////////////////////////////////////////////////////////////////
7
0b70c946
FM
8
9/**
6aea1e4a
FM
10 Standard font families: these are used mainly during wxFont creation to specify
11 the generic properties of the font without hardcoding in the sources a specific
12 face name.
13
14 wxFontFamily thus allows to group the font face names of fonts with similar
15 properties. Most wxWidgets ports use lists of fonts for each font family
16 inspired by the data taken from http://www.codestyle.org/css/font-family.
0b70c946
FM
17*/
18enum wxFontFamily
19{
20 wxFONTFAMILY_DEFAULT = wxDEFAULT, //!< Chooses a default font.
f76c0758 21
0b70c946
FM
22 wxFONTFAMILY_DECORATIVE = wxDECORATIVE, //!< A decorative font.
23 wxFONTFAMILY_ROMAN = wxROMAN, //!< A formal, serif font.
24 wxFONTFAMILY_SCRIPT = wxSCRIPT, //!< A handwriting font.
25 wxFONTFAMILY_SWISS = wxSWISS, //!< A sans-serif font.
f76c0758 26
6aea1e4a
FM
27 /// A fixed pitch font. Note that wxFont currently does not make distinctions
28 /// between @c wxFONTFAMILY_MODERN and @c wxFONTFAMILY_TELETYPE.
29 wxFONTFAMILY_MODERN = wxMODERN,
f76c0758 30
6aea1e4a 31 /// A teletype (i.e. monospaced) font.
f76c0758
VZ
32 /// Monospace fonts have a fixed width like typewriters and often have strong angular
33 /// or block serifs. Monospace font faces are often used code samples and have a simple,
6aea1e4a
FM
34 /// functional font style.
35 /// See also wxFont::IsFixedWidth() for an easy way to test for monospace property.
36 wxFONTFAMILY_TELETYPE = wxTELETYPE,
f76c0758 37
e9321277 38 wxFONTFAMILY_MAX,
59b7da02
VZ
39 /// Invalid font family value, returned by wxFont::GetFamily() when the
40 /// font is invalid for example.
e9321277 41 wxFONTFAMILY_UNKNOWN = wxFONTFAMILY_MAX
0b70c946
FM
42};
43
44/**
45 Font styles.
46*/
47enum wxFontStyle
48{
071de7a0 49 /// The font is drawn without slant.
0b70c946 50 wxFONTSTYLE_NORMAL = wxNORMAL,
071de7a0
FM
51
52 /// The font is slanted in an italic style.
0b70c946 53 wxFONTSTYLE_ITALIC = wxITALIC,
f76c0758
VZ
54
55 /// The font is slanted, but in a roman style.
071de7a0 56 /// Note that under wxMSW this style is the same as @c wxFONTSTYLE_ITALIC.
0b70c946 57 wxFONTSTYLE_SLANT = wxSLANT,
071de7a0 58
0b70c946
FM
59 wxFONTSTYLE_MAX
60};
61
62/**
63 Font weights.
64*/
65enum wxFontWeight
66{
67 wxFONTWEIGHT_NORMAL = wxNORMAL, //!< Normal font.
68 wxFONTWEIGHT_LIGHT = wxLIGHT, //!< Light font.
69 wxFONTWEIGHT_BOLD = wxBOLD, //!< Bold font.
70 wxFONTWEIGHT_MAX
71};
72
19da7aaa
VZ
73/**
74 Symbolic font sizes.
75
76 The elements of this enum correspond to CSS absolute size specifications,
77 see http://www.w3.org/TR/CSS21/fonts.html#font-size-props
78
79 @see wxFont::SetSymbolicSize()
80
81 @since 2.9.2
82 */
83enum wxFontSymbolicSize
84{
85 wxFONTSIZE_XX_SMALL = -3, //!< Extra small.
86 wxFONTSIZE_X_SMALL, //!< Very small.
87 wxFONTSIZE_SMALL, //!< Small.
88 wxFONTSIZE_MEDIUM, //!< Normal.
89 wxFONTSIZE_LARGE, //!< Large.
90 wxFONTSIZE_X_LARGE, //!< Very large.
91 wxFONTSIZE_XX_LARGE //!< Extra large.
92};
93
0b70c946
FM
94/**
95 The font flag bits for the new font ctor accepting one combined flags word.
96*/
97enum wxFontFlag
98{
99 /// no special flags: font with default weight/slant/anti-aliasing
100 wxFONTFLAG_DEFAULT = 0,
101
102 /// slant flags (default: no slant)
103 wxFONTFLAG_ITALIC = 1 << 0,
104 wxFONTFLAG_SLANT = 1 << 1,
105
106 /// weight flags (default: medium)
107 wxFONTFLAG_LIGHT = 1 << 2,
108 wxFONTFLAG_BOLD = 1 << 3,
109
110 /// anti-aliasing flag: force on or off (default: the current system default)
111 wxFONTFLAG_ANTIALIASED = 1 << 4,
112 wxFONTFLAG_NOT_ANTIALIASED = 1 << 5,
113
c7a49742 114 /// Underlined style (not underlined by default).
0b70c946 115 wxFONTFLAG_UNDERLINED = 1 << 6,
c7a49742
VZ
116
117 /// Strike-through style (only supported in wxMSW and wxGTK currently).
0b70c946
FM
118 wxFONTFLAG_STRIKETHROUGH = 1 << 7,
119
120 /// the mask of all currently used flags
121 wxFONTFLAG_MASK = wxFONTFLAG_ITALIC |
122 wxFONTFLAG_SLANT |
123 wxFONTFLAG_LIGHT |
124 wxFONTFLAG_BOLD |
125 wxFONTFLAG_ANTIALIASED |
126 wxFONTFLAG_NOT_ANTIALIASED |
127 wxFONTFLAG_UNDERLINED |
128 wxFONTFLAG_STRIKETHROUGH
129};
130
131
132
133/**
134 Font encodings.
f76c0758 135
7ce58684 136 See wxFont::SetEncoding().
0b70c946
FM
137*/
138enum wxFontEncoding
139{
140 /// Default system encoding.
141 wxFONTENCODING_SYSTEM = -1, // system default
142
143 /// Default application encoding.
144 wxFONTENCODING_DEFAULT, // current default encoding
145
146 // ISO8859 standard defines a number of single-byte charsets
9a6fda22
FM
147 wxFONTENCODING_ISO8859_1, //!< West European (Latin1)
148 wxFONTENCODING_ISO8859_2, //!< Central and East European (Latin2)
149 wxFONTENCODING_ISO8859_3, //!< Esperanto (Latin3)
150 wxFONTENCODING_ISO8859_4, //!< Baltic (old) (Latin4)
151 wxFONTENCODING_ISO8859_5, //!< Cyrillic
152 wxFONTENCODING_ISO8859_6, //!< Arabic
153 wxFONTENCODING_ISO8859_7, //!< Greek
154 wxFONTENCODING_ISO8859_8, //!< Hebrew
155 wxFONTENCODING_ISO8859_9, //!< Turkish (Latin5)
156 wxFONTENCODING_ISO8859_10, //!< Variation of Latin4 (Latin6)
157 wxFONTENCODING_ISO8859_11, //!< Thai
158 wxFONTENCODING_ISO8859_12, //!< doesn't exist currently, but put it
159 //!< here anyhow to make all ISO8859
160 //!< consecutive numbers
161 wxFONTENCODING_ISO8859_13, //!< Baltic (Latin7)
162 wxFONTENCODING_ISO8859_14, //!< Latin8
163 wxFONTENCODING_ISO8859_15, //!< Latin9 (a.k.a. Latin0, includes euro)
0b70c946
FM
164 wxFONTENCODING_ISO8859_MAX,
165
166 // Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html)
9a6fda22
FM
167 wxFONTENCODING_KOI8, //!< KOI8 Russian
168 wxFONTENCODING_KOI8_U, //!< KOI8 Ukrainian
169 wxFONTENCODING_ALTERNATIVE, //!< same as MS-DOS CP866
170 wxFONTENCODING_BULGARIAN, //!< used under Linux in Bulgaria
0b70c946
FM
171
172 // what would we do without Microsoft? They have their own encodings
173 // for DOS
9a6fda22
FM
174 wxFONTENCODING_CP437, //!< original MS-DOS codepage
175 wxFONTENCODING_CP850, //!< CP437 merged with Latin1
176 wxFONTENCODING_CP852, //!< CP437 merged with Latin2
177 wxFONTENCODING_CP855, //!< another cyrillic encoding
178 wxFONTENCODING_CP866, //!< and another one
0b70c946 179 // and for Windows
9a6fda22
FM
180 wxFONTENCODING_CP874, //!< WinThai
181 wxFONTENCODING_CP932, //!< Japanese (shift-JIS)
182 wxFONTENCODING_CP936, //!< Chinese simplified (GB)
183 wxFONTENCODING_CP949, //!< Korean (Hangul charset)
184 wxFONTENCODING_CP950, //!< Chinese (traditional - Big5)
185 wxFONTENCODING_CP1250, //!< WinLatin2
186 wxFONTENCODING_CP1251, //!< WinCyrillic
187 wxFONTENCODING_CP1252, //!< WinLatin1
188 wxFONTENCODING_CP1253, //!< WinGreek (8859-7)
189 wxFONTENCODING_CP1254, //!< WinTurkish
190 wxFONTENCODING_CP1255, //!< WinHebrew
191 wxFONTENCODING_CP1256, //!< WinArabic
192 wxFONTENCODING_CP1257, //!< WinBaltic (same as Latin 7)
2253f181
VZ
193 wxFONTENCODING_CP1258, //!< WinVietnamese (since 2.9.4)
194 wxFONTENCODING_CP1361, //!< Johab Korean character set (since 2.9.4)
0b70c946
FM
195 wxFONTENCODING_CP12_MAX,
196
9a6fda22
FM
197 wxFONTENCODING_UTF7, //!< UTF-7 Unicode encoding
198 wxFONTENCODING_UTF8, //!< UTF-8 Unicode encoding
199 wxFONTENCODING_EUC_JP, //!< Extended Unix Codepage for Japanese
200 wxFONTENCODING_UTF16BE, //!< UTF-16 Big Endian Unicode encoding
201 wxFONTENCODING_UTF16LE, //!< UTF-16 Little Endian Unicode encoding
202 wxFONTENCODING_UTF32BE, //!< UTF-32 Big Endian Unicode encoding
0b70c946
FM
203 wxFONTENCODING_UTF32LE, // UTF-32 Little Endian Unicode encoding
204
9a6fda22 205 wxFONTENCODING_MACROMAN, //!< the standard mac encodings
0b70c946
FM
206 wxFONTENCODING_MACJAPANESE,
207 wxFONTENCODING_MACCHINESETRAD,
208 wxFONTENCODING_MACKOREAN,
209 wxFONTENCODING_MACARABIC,
210 wxFONTENCODING_MACHEBREW,
211 wxFONTENCODING_MACGREEK,
212 wxFONTENCODING_MACCYRILLIC,
213 wxFONTENCODING_MACDEVANAGARI,
214 wxFONTENCODING_MACGURMUKHI,
215 wxFONTENCODING_MACGUJARATI,
216 wxFONTENCODING_MACORIYA,
217 wxFONTENCODING_MACBENGALI,
218 wxFONTENCODING_MACTAMIL,
219 wxFONTENCODING_MACTELUGU,
220 wxFONTENCODING_MACKANNADA,
221 wxFONTENCODING_MACMALAJALAM,
222 wxFONTENCODING_MACSINHALESE,
223 wxFONTENCODING_MACBURMESE,
224 wxFONTENCODING_MACKHMER,
225 wxFONTENCODING_MACTHAI,
226 wxFONTENCODING_MACLAOTIAN,
227 wxFONTENCODING_MACGEORGIAN,
228 wxFONTENCODING_MACARMENIAN,
229 wxFONTENCODING_MACCHINESESIMP,
230 wxFONTENCODING_MACTIBETAN,
231 wxFONTENCODING_MACMONGOLIAN,
232 wxFONTENCODING_MACETHIOPIC,
233 wxFONTENCODING_MACCENTRALEUR,
234 wxFONTENCODING_MACVIATNAMESE,
235 wxFONTENCODING_MACARABICEXT,
236 wxFONTENCODING_MACSYMBOL,
237 wxFONTENCODING_MACDINGBATS,
238 wxFONTENCODING_MACTURKISH,
239 wxFONTENCODING_MACCROATIAN,
240 wxFONTENCODING_MACICELANDIC,
241 wxFONTENCODING_MACROMANIAN,
242 wxFONTENCODING_MACCELTIC,
243 wxFONTENCODING_MACGAELIC,
244 wxFONTENCODING_MACKEYBOARD,
245
246 // more CJK encodings (for historical reasons some are already declared
247 // above)
9a6fda22 248 wxFONTENCODING_ISO2022_JP, //!< ISO-2022-JP JIS encoding
0b70c946 249
9a6fda22 250 wxFONTENCODING_MAX, //!< highest enumerated encoding value
0b70c946
FM
251
252 wxFONTENCODING_MACMIN = wxFONTENCODING_MACROMAN ,
253 wxFONTENCODING_MACMAX = wxFONTENCODING_MACKEYBOARD ,
254
255 // aliases for endian-dependent UTF encodings
9a6fda22
FM
256 wxFONTENCODING_UTF16, //!< native UTF-16
257 wxFONTENCODING_UTF32, //!< native UTF-32
258
259 /// Alias for the native Unicode encoding on this platform
260 /// (this is used by wxEncodingConverter and wxUTFFile only for now)
261 wxFONTENCODING_UNICODE,
0b70c946 262
9a6fda22
FM
263 wxFONTENCODING_GB2312 = wxFONTENCODING_CP936, //!< Simplified Chinese
264 wxFONTENCODING_BIG5 = wxFONTENCODING_CP950, //!< Traditional Chinese
3d4e20dd 265 wxFONTENCODING_SHIFT_JIS = wxFONTENCODING_CP932, //!< Shift JIS
2253f181
VZ
266 wxFONTENCODING_EUC_KR = wxFONTENCODING_CP949, //!< Korean
267 wxFONTENCODING_JOHAB = wxFONTENCODING_CP1361, //!< Korean Johab (since 2.9.4)
268 wxFONTENCODING_VIETNAMESE = wxFONTENCODING_CP1258 //!< Vietnamese (since 2.9.4)
0b70c946
FM
269};
270
271
b960795e 272/**
4a9d5313 273 @class wxFontInfo
b960795e
VZ
274
275 This class is a helper used for wxFont creation using named parameter
276 idiom: it allows to specify various wxFont attributes using the chained
277 calls to its clearly named methods instead of passing them in the fixed
278 order to wxFont constructors.
279
280 For example, to create an italic font with the given face name and size you
281 could use:
282 @code
4a9d5313 283 wxFont font(wxFontInfo(12).FaceName("Helvetica").Italic());
b960795e
VZ
284 @endcode
285
286 Notice that all of the methods of this object return a reference to the
287 object itself, allowing the calls to them to be chained as in the example
288 above.
289
290 All methods taking boolean parameters can be used to turn the specified
291 font attribute on or off and turn it on by default.
292
293 @since 2.9.5
294 */
295class wxFontInfo
296{
297public:
298 /**
299 Default constructor uses the default font size for the current
300 platform.
301 */
302 wxFontInfo();
303
304 /**
305 Constructor setting the font size in points to use.
306
307 @see wxFont::SetPointSize()
308 */
309 explicit wxFontInfo(int pointSize);
310
311 /**
312 Constructor setting the font size in pixels to use.
313
314 @see wxFont::SetPixelSize()
315 */
316 explicit wxFontInfo(const wxSize& pixelSize);
317
318 /**
319 Set the font family.
320
321 The family is a generic portable way of referring to fonts without
322 specifying a precise face name. This parameter must be one of the
323 ::wxFontFamily enumeration values.
324
325 If the FaceName() is used, then it overrides the font family.
326
327 @see wxFont::SetFamily()
328 */
329 wxFontInfo& Family(wxFontFamily family);
330
331 /**
332 Set the font face name to use.
333
334 Face names are not portable, so prefer to use Family() in portable
335 code.
336
337 @see wxFont::SetFaceName()
338 */
339 wxFontInfo& FaceName(const wxString& faceName);
340
341 /**
342 Use a bold version of the font.
343
344 @see ::wxFontWeight, wxFont::SetWeight()
345 */
346 wxFontInfo& Bold(bool bold = true);
347
348 /**
349 Use a lighter version of the font.
350
351 @see ::wxFontWeight, wxFont::SetWeight()
352 */
353 wxFontInfo& Light(bool light = true);
354
355 /**
356 Use an italic version of the font.
357
358 @see ::wxFontStyle, wxFont::SetStyle()
359 */
360 wxFontInfo& Italic(bool italic = true);
361
362 /**
363 Use a slanted version of the font.
364
365 @see ::wxFontStyle, wxFont::SetStyle()
366 */
367 wxFontInfo& Slant(bool slant = true);
368
369 /**
370 Set anti-aliasing flag.
371
372 Force the use of anti-aliasing on or off.
373
374 Currently this is not implemented, i.e. using this method doesn't do
375 anything.
376 */
377 wxFontInfo& AntiAliased(bool antiAliased = true);
378
379 /**
380 Use an underlined version of the font.
381 */
382 wxFontInfo& Underlined(bool underlined = true);
383
384 /**
385 Use a strike-through version of the font.
386
387 Currently this is only implemented in wxMSW and wxGTK.
388 */
389 wxFontInfo& Strikethrough(bool strikethrough = true);
390
391 /**
392 Set the font encoding to use.
393
394 This is mostly unneeded in Unicode builds of wxWidgets.
395
396 @see ::wxFontEncoding, wxFont::SetEncoding()
397 */
398 wxFontInfo& Encoding(wxFontEncoding encoding);
399
400 /**
401 Set all the font attributes at once.
402
403 See ::wxFontFlag for the various flags that can be used.
404 */
405 wxFontInfo& AllFlags(int flags);
406};
407
23324ae1
FM
408/**
409 @class wxFont
7c913512 410
0b70c946 411 A font is an object which determines the appearance of text.
b960795e 412
0b70c946 413 Fonts are used for drawing text to a device context, and setting the appearance
b960795e
VZ
414 of a window's text, see wxDC::SetFont() and wxWindow::SetFont().
415
416 The easiest way to create a custom font is to use wxFontInfo object to
417 specify the font attributes and then use wxFont::wxFont(const wxFontInfo&)
418 constructor. Alternatively, you could start with one of the pre-defined
419 fonts or use wxWindow::GetFont() and modify the font, e.g. by increasing
420 its size using MakeLarger() or changing its weight using MakeBold().
7c913512 421
0b70c946 422 This class uses @ref overview_refcount "reference counting and copy-on-write"
23324ae1
FM
423 internally so that assignments between two instances of this class are very
424 cheap. You can therefore use actual objects instead of pointers without
425 efficiency problems. If an instance of this class is changed it will create
426 its own data internally so that other instances, which previously shared the
427 data using the reference counting, are not affected.
7c913512 428
23324ae1 429 You can retrieve the current system font settings with wxSystemSettings.
7c913512 430
23324ae1
FM
431 @library{wxcore}
432 @category{gdi}
7c913512 433
23324ae1 434 @stdobjects
65874118 435 ::wxNullFont, ::wxNORMAL_FONT, ::wxSMALL_FONT, ::wxITALIC_FONT, ::wxSWISS_FONT
7c913512 436
0b70c946
FM
437 @see @ref overview_font, wxDC::SetFont, wxDC::DrawText,
438 wxDC::GetTextExtent, wxFontDialog, wxSystemSettings
23324ae1
FM
439*/
440class wxFont : public wxGDIObject
441{
442public:
45a591fa 443 /**
0b70c946 444 Default ctor.
45a591fa
VZ
445 */
446 wxFont();
447
448 /**
0b70c946 449 Copy constructor, uses @ref overview_refcount "reference counting".
45a591fa
VZ
450 */
451 wxFont(const wxFont& font);
452
b960795e
VZ
453 /**
454 Creates a font object using the specified font description.
455
456 This is the preferred way to create font objects as using this ctor
457 results in more readable code and it is also extensible, e.g. it could
458 continue to be used if support for more font attributes is added in the
459 future. For example, this constructor provides the only way of creating
460 fonts with strike-through style.
461
462 Example of creating a font using this ctor:
463 @code
464 wxFont font(wxFontInfo(10).Bold().Underlined());
465 @endcode
466
467 @since 2.9.5
468 */
469 wxFont(const wxFontInfo& font);
470
23324ae1 471 /**
0634700a 472 Creates a font object with the specified attributes and size in points.
3c4f71cc 473
b960795e
VZ
474 Notice that the use of this constructor is often more verbose and less
475 readable than the use of constructor from wxFontInfo, e.g. the example
476 in that constructor documentation would need to be written as
477 @code
478 wxFont font(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
479 wxFONTWEIGHT_BOLD, true);
480 @endcode
481 which is longer and less clear.
482
7c913512 483 @param pointSize
b5791cc7 484 Size in points. See SetPointSize() for more info.
45a591fa 485 @param family
6aea1e4a
FM
486 The font family: a generic portable way of referring to fonts without specifying a
487 facename. This parameter must be one of the ::wxFontFamily enumeration values.
488 If the @a faceName argument is provided, then it overrides the font family.
45a591fa 489 @param style
b5791cc7 490 One of @c wxFONTSTYLE_NORMAL, @c wxFONTSTYLE_SLANT and @c wxFONTSTYLE_ITALIC.
45a591fa 491 @param weight
f76c0758 492 Font weight, sometimes also referred to as font boldness.
b5791cc7 493 One of the ::wxFontWeight enumeration values.
45a591fa 494 @param underline
0b70c946
FM
495 The value can be @true or @false.
496 At present this has an effect on Windows and Motif 2.x only.
45a591fa 497 @param faceName
6aea1e4a
FM
498 An optional string specifying the face name to be used.
499 If it is an empty string, a default face name will be chosen based on the family.
45a591fa 500 @param encoding
0b70c946
FM
501 An encoding which may be one of the enumeration values of ::wxFontEncoding.
502 Briefly these can be summed up as:
503 <TABLE>
b5791cc7
FM
504 <TR><TD>@c wxFONTENCODING_SYSTEM</TD><TD>Default system encoding.</TD></TR>
505 <TR><TD>@c wxFONTENCODING_DEFAULT</TD><TD>
8f1337ed 506 Default application encoding: this is the encoding set by calls to
f76c0758
VZ
507 SetDefaultEncoding() and which may be set to, say, KOI8 to create all
508 fonts by default with KOI8 encoding. Initially, the default application
8f1337ed 509 encoding is the same as default system encoding.</TD></TR>
b5791cc7
FM
510 <TR><TD>@c wxFONTENCODING_ISO8859_1...15</TD><TD>ISO8859 encodings.</TD></TR>
511 <TR><TD>@c wxFONTENCODING_KOI8</TD><TD>The standard Russian encoding for Internet.</TD></TR>
512 <TR><TD>@c wxFONTENCODING_CP1250...1252</TD><TD>Windows encodings similar to ISO8859 (but not identical).</TD></TR>
0b70c946 513 </TABLE>
45a591fa 514 If the specified encoding isn't available, no font is created
8f1337ed 515 (see also @ref overview_fontencoding).
45a591fa
VZ
516
517 @remarks If the desired font does not exist, the closest match will be
0b70c946 518 chosen. Under Windows, only scalable TrueType fonts are used.
45a591fa 519 */
882678eb 520 wxFont(int pointSize, wxFontFamily family, wxFontStyle style,
45a591fa 521 wxFontWeight weight,
11e3af6e 522 bool underline = false,
e9c3992c 523 const wxString& faceName = wxEmptyString,
45a591fa 524 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
0b70c946 525
45a591fa 526 /**
0634700a 527 Creates a font object with the specified attributes and size in pixels.
45a591fa 528
b960795e
VZ
529 Notice that the use of this constructor is often more verbose and less
530 readable than the use of constructor from wxFontInfo, consider using
531 that constructor instead.
532
7c913512 533 @param pixelSize
b5791cc7 534 Size in pixels. See SetPixelSize() for more info.
7c913512 535 @param family
6aea1e4a
FM
536 The font family: a generic portable way of referring to fonts without specifying a
537 facename. This parameter must be one of the ::wxFontFamily enumeration values.
538 If the @a faceName argument is provided, then it overrides the font family.
4cc4bfaf 539 @param style
b5791cc7 540 One of @c wxFONTSTYLE_NORMAL, @c wxFONTSTYLE_SLANT and @c wxFONTSTYLE_ITALIC.
7c913512 541 @param weight
0b70c946
FM
542 Font weight, sometimes also referred to as font boldness.
543 One of the ::wxFontWeight enumeration values.
4cc4bfaf 544 @param underline
0b70c946
FM
545 The value can be @true or @false.
546 At present this has an effect on Windows and Motif 2.x only.
4cc4bfaf 547 @param faceName
6aea1e4a
FM
548 An optional string specifying the face name to be used.
549 If it is an empty string, a default face name will be chosen based on the family.
7c913512 550 @param encoding
0b70c946
FM
551 An encoding which may be one of the enumeration values of ::wxFontEncoding.
552 Briefly these can be summed up as:
553 <TABLE>
b5791cc7
FM
554 <TR><TD>@c wxFONTENCODING_SYSTEM</TD><TD>Default system encoding.</TD></TR>
555 <TR><TD>@c wxFONTENCODING_DEFAULT</TD><TD>
8f1337ed 556 Default application encoding: this is the encoding set by calls to
f76c0758
VZ
557 SetDefaultEncoding() and which may be set to, say, KOI8 to create all
558 fonts by default with KOI8 encoding. Initially, the default application
8f1337ed 559 encoding is the same as default system encoding.</TD></TR>
b5791cc7
FM
560 <TR><TD>@c wxFONTENCODING_ISO8859_1...15</TD><TD>ISO8859 encodings.</TD></TR>
561 <TR><TD>@c wxFONTENCODING_KOI8</TD><TD>The standard Russian encoding for Internet.</TD></TR>
562 <TR><TD>@c wxFONTENCODING_CP1250...1252</TD><TD>Windows encodings similar to ISO8859 (but not identical).</TD></TR>
0b70c946 563 </TABLE>
4cc4bfaf 564 If the specified encoding isn't available, no font is created
8f1337ed 565 (see also @ref overview_fontencoding).
3c4f71cc 566
23324ae1 567 @remarks If the desired font does not exist, the closest match will be
0b70c946 568 chosen. Under Windows, only scalable TrueType fonts are used.
23324ae1 569 */
7c913512 570 wxFont(const wxSize& pixelSize, wxFontFamily family,
882678eb 571 wxFontStyle style, wxFontWeight weight,
11e3af6e 572 bool underline = false,
e9c3992c 573 const wxString& faceName = wxEmptyString,
7c913512 574 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
23324ae1 575
20cc4e19
VZ
576 /**
577 Constructor from font description string.
578
6aea1e4a
FM
579 This constructor uses SetNativeFontInfo() to initialize the font.
580 If @a fontdesc is invalid the font remains uninitialized, i.e. its IsOk() method
20cc4e19
VZ
581 will return @false.
582 */
d775ec48
RD
583 wxFont(const wxString& nativeInfoString);
584
585 /**
586 Construct font from a native font info structure.
587 */
588 wxFont(const wxNativeFontInfo& nativeInfo);
20cc4e19 589
23324ae1
FM
590 /**
591 Destructor.
0b70c946 592
674d80a7 593 See @ref overview_refcount_destruct "reference-counted object destruction"
0b70c946 594 for more info.
3c4f71cc 595
23324ae1 596 @remarks Although all remaining fonts are deleted when the application
4cc4bfaf
FM
597 exits, the application should try to clean up all fonts
598 itself. This is because wxWidgets cannot know if a
599 pointer to the font object is stored in an application
600 data structure, and there is a risk of double deletion.
23324ae1 601 */
adaaa686 602 virtual ~wxFont();
23324ae1 603
f76c0758 604
23324ae1 605 /**
060c4f90 606 @name Getters
23324ae1 607 */
060c4f90 608 //@{
f76c0758 609
7ce58684
FM
610 /**
611 Returns the encoding of this font.
f76c0758 612
7ce58684 613 Note that under wxGTK the returned value is always @c wxFONTENCODING_UTF8.
f76c0758 614
7ce58684
FM
615 @see SetEncoding()
616 */
617 virtual wxFontEncoding GetEncoding() const;
f76c0758 618
23324ae1 619 /**
6aea1e4a
FM
620 Returns the face name associated with the font, or the empty string if
621 there is no face information.
3c4f71cc 622
4cc4bfaf 623 @see SetFaceName()
23324ae1 624 */
adaaa686 625 virtual wxString GetFaceName() const;
23324ae1
FM
626
627 /**
59b7da02
VZ
628 Gets the font family if possible.
629
6aea1e4a
FM
630 As described in ::wxFontFamily docs the returned value acts as a rough,
631 basic classification of the main font properties (look, spacing).
f76c0758 632
6aea1e4a 633 If the current font face name is not recognized by wxFont or by the
59b7da02 634 underlying system, @c wxFONTFAMILY_DEFAULT is returned.
f76c0758 635
59b7da02
VZ
636 Note that currently this function is not very precise and so not
637 particularly useful. Font families mostly make sense only for font
638 creation, see SetFamily().
3c4f71cc 639
4cc4bfaf 640 @see SetFamily()
23324ae1 641 */
26818748 642 virtual wxFontFamily GetFamily() const;
23324ae1
FM
643
644 /**
645 Returns the platform-dependent string completely describing this font.
64932e41
VZ
646
647 Returned string is always non-empty unless the font is invalid (in
648 which case an assert is triggered).
0b70c946 649
23324ae1 650 Note that the returned string is not meant to be shown or edited by the user: a
0b70c946 651 typical use of this function is for serializing in string-form a wxFont object.
3c4f71cc 652
a912ea26 653 @see SetNativeFontInfo(), GetNativeFontInfoUserDesc()
23324ae1 654 */
328f5751 655 wxString GetNativeFontInfoDesc() const;
23324ae1
FM
656
657 /**
0b70c946 658 Returns a user-friendly string for this font object.
64932e41
VZ
659
660 Returned string is always non-empty unless the font is invalid (in
661 which case an assert is triggered).
f76c0758 662
a912ea26
FM
663 The string does not encode all wxFont infos under all platforms;
664 e.g. under wxMSW the font family is not present in the returned string.
0b70c946 665
23324ae1
FM
666 Some examples of the formats of returned strings (which are platform-dependent)
667 are in SetNativeFontInfoUserDesc().
3c4f71cc 668
a912ea26 669 @see SetNativeFontInfoUserDesc(), GetNativeFontInfoDesc()
23324ae1 670 */
adaaa686 671 wxString GetNativeFontInfoUserDesc() const;
23324ae1 672
d775ec48
RD
673 const wxNativeFontInfo *GetNativeFontInfo() const;
674
23324ae1
FM
675 /**
676 Gets the point size.
3c4f71cc 677
4cc4bfaf 678 @see SetPointSize()
23324ae1 679 */
adaaa686 680 virtual int GetPointSize() const;
23324ae1
FM
681
682 /**
b5791cc7 683 Gets the pixel size.
f76c0758 684
b5791cc7
FM
685 Note that under wxMSW if you passed to SetPixelSize() (or to the ctor)
686 a wxSize object with a null width value, you'll get a null width in
687 the returned object.
688
689 @see SetPixelSize()
690 */
691 virtual wxSize GetPixelSize() const;
f76c0758 692
b5791cc7
FM
693 /**
694 Gets the font style. See ::wxFontStyle for a list of valid styles.
3c4f71cc 695
4cc4bfaf 696 @see SetStyle()
23324ae1 697 */
26818748 698 virtual wxFontStyle GetStyle() const;
23324ae1
FM
699
700 /**
701 Returns @true if the font is underlined, @false otherwise.
3c4f71cc 702
4cc4bfaf 703 @see SetUnderlined()
23324ae1 704 */
adaaa686 705 virtual bool GetUnderlined() const;
23324ae1 706
c7a49742
VZ
707 /**
708 Returns @true if the font is stricken-through, @false otherwise.
709
710 @see SetStrikethrough()
711
712 @since 2.9.4
713 */
714 virtual bool GetStrikethrough() const;
715
23324ae1 716 /**
b5791cc7 717 Gets the font weight. See ::wxFontWeight for a list of valid weight identifiers.
3c4f71cc 718
4cc4bfaf 719 @see SetWeight()
23324ae1 720 */
26818748 721 virtual wxFontWeight GetWeight() const;
23324ae1
FM
722
723 /**
724 Returns @true if the font is a fixed width (or monospaced) font,
725 @false if it is a proportional one or font is invalid.
f76c0758 726
6aea1e4a
FM
727 Note that this function under some platforms is different than just testing
728 for the font family being equal to @c wxFONTFAMILY_TELETYPE because native
729 platform-specific functions are used for the check (resulting in a more
730 accurate return value).
23324ae1 731 */
adaaa686 732 virtual bool IsFixedWidth() const;
23324ae1
FM
733
734 /**
735 Returns @true if this object is a valid font, @false otherwise.
736 */
0004982c 737 virtual bool IsOk() const;
f76c0758
VZ
738
739 //@}
740
741
742 /**
743 @name Similar fonts creation
744
6e7d2550
VZ
745 The functions in this section either modify the font in place or create
746 a new font similar to the given one but with its weight, style or size
747 changed.
f76c0758
VZ
748 */
749 //@{
750
751 /**
efb09182 752 Returns a bold version of this font.
6e7d2550
VZ
753
754 @see MakeBold()
755
756 @since 2.9.1
f76c0758 757 */
6e7d2550 758 wxFont Bold() const;
f76c0758
VZ
759
760 /**
efb09182 761 Returns an italic version of this font.
6e7d2550
VZ
762
763 @see MakeItalic()
764
765 @since 2.9.1
f76c0758 766 */
6e7d2550 767 wxFont Italic() const;
f76c0758
VZ
768
769 /**
efb09182 770 Returns a larger version of this font.
f76c0758 771
efb09182
VZ
772 The font size is multiplied by @c 1.2, the factor of @c 1.2 being
773 inspired by the W3C CSS specification.
f76c0758 774
efb09182 775 @see MakeLarger(), Smaller(), Scaled()
6e7d2550
VZ
776
777 @since 2.9.1
778 */
779 wxFont Larger() const;
780
efb09182
VZ
781 /**
782 Returns a smaller version of this font.
783
784 The font size is divided by @c 1.2, the factor of @c 1.2 being
785 inspired by the W3C CSS specification.
786
787 @see MakeSmaller(), Larger(), Scaled()
788
789 @since 2.9.1
790 */
791 wxFont Smaller() const;
792
801423ee
VZ
793 /**
794 Returns underlined version of this font.
795
796 @see MakeUnderlined()
797
798 @since 2.9.2
799 */
800 wxFont Underlined() const;
801
c7a49742
VZ
802 /**
803 Returns stricken-through version of this font.
804
805 Currently stricken-through fonts are only supported in wxMSW and wxGTK.
806
807 @see MakeStrikethrough()
808
809 @since 2.9.4
810 */
811 wxFont Strikethrough() const;
812
6e7d2550
VZ
813 /**
814 Changes this font to be bold.
815
816 @see Bold()
817
818 @since 2.9.1
819 */
820 wxFont& MakeBold();
821
822 /**
823 Changes this font to be italic.
824
825 @see Italic()
826
827 @since 2.9.1
f76c0758 828 */
6e7d2550
VZ
829 wxFont& MakeItalic();
830
831 /**
832 Changes this font to be larger.
833
efb09182
VZ
834 The font size is multiplied by @c 1.2, the factor of @c 1.2 being
835 inspired by the W3C CSS specification.
6e7d2550
VZ
836
837 @see Larger(), MakeSmaller(), Scale()
838
839 @since 2.9.1
840 */
841 wxFont& MakeLarger();
f76c0758
VZ
842
843 /**
efb09182 844 Changes this font to be smaller.
f76c0758 845
efb09182
VZ
846 The font size is divided by @c 1.2, the factor of @c 1.2 being
847 inspired by the W3C CSS specification.
f76c0758 848
efb09182 849 @see Smaller(), MakeLarger(), Scale()
6e7d2550
VZ
850
851 @since 2.9.1
f76c0758 852 */
6e7d2550
VZ
853 wxFont& MakeSmaller();
854
801423ee
VZ
855 /**
856 Changes this font to be underlined.
857
858 @see Underlined()
859
860 @since 2.9.2
861 */
862 wxFont& MakeUnderlined();
863
c7a49742
VZ
864 /**
865 Changes this font to be stricken-through.
866
867 Currently stricken-through fonts are only supported in wxMSW and wxGTK.
868
869 @see Strikethrough()
870
871 @since 2.9.4
872 */
873 wxFont& MakeStrikethrough();
874
6e7d2550
VZ
875 /**
876 Changes the size of this font.
877
878 The font size is multiplied by the given factor (which may be less than
879 1 to create a smaller version of the font).
880
881 @see Scaled(), MakeLarger(), MakeSmaller()
882
883 @since 2.9.1
884 */
885 wxFont& Scale(float x);
f76c0758
VZ
886
887 /**
efb09182 888 Returns a scaled version of this font.
f76c0758
VZ
889
890 The font size is multiplied by the given factor (which may be less than
891 1 to create a smaller version of the font).
6e7d2550
VZ
892
893 @see Scale(), Larger(), Smaller()
894
895 @since 2.9.1
896 */
897 wxFont Scaled(float x) const;
898
23324ae1 899 //@}
f76c0758 900
23324ae1 901 /**
060c4f90 902 @name Setters
f76c0758 903
060c4f90
FM
904 These functions internally recreate the native font object with the new
905 specified property.
23324ae1 906 */
060c4f90
FM
907 //@{
908
7ce58684
FM
909 /**
910 Sets the encoding for this font.
f76c0758 911
7ce58684
FM
912 Note that under wxGTK this function has no effect (because the underlying
913 Pango library always uses @c wxFONTENCODING_UTF8).
f76c0758 914
7ce58684
FM
915 @see GetEncoding()
916 */
917 virtual void SetEncoding(wxFontEncoding encoding);
23324ae1
FM
918
919 /**
920 Sets the facename for the font.
3c4f71cc 921
7c913512 922 @param faceName
4cc4bfaf 923 A valid facename, which should be on the end-user's system.
3c4f71cc 924
23324ae1 925 @remarks To avoid portability problems, don't rely on a specific face,
f7008bad
FM
926 but specify the font family instead (see ::wxFontFamily and SetFamily()).
927
928 @return @true if the given face name exists; if the face name doesn't exist
f76c0758 929 in the user's system then the font is invalidated (so that IsOk() will
f7008bad 930 return @false) and @false is returned.
3c4f71cc 931
4cc4bfaf 932 @see GetFaceName(), SetFamily()
23324ae1 933 */
adaaa686 934 virtual bool SetFaceName(const wxString& faceName);
23324ae1
FM
935
936 /**
937 Sets the font family.
f76c0758 938
060c4f90
FM
939 As described in ::wxFontFamily docs the given @a family value acts as a rough,
940 basic indication of the main font properties (look, spacing).
941
942 Note that changing the font family results in changing the font face name.
3c4f71cc 943
7c913512 944 @param family
0b70c946 945 One of the ::wxFontFamily values.
3c4f71cc 946
4cc4bfaf 947 @see GetFamily(), SetFaceName()
23324ae1 948 */
a44f3b5a 949 virtual void SetFamily(wxFontFamily family);
23324ae1
FM
950
951 /**
0b70c946
FM
952 Creates the font corresponding to the given native font description string
953 which must have been previously returned by GetNativeFontInfoDesc().
954
955 If the string is invalid, font is unchanged.
956 This function is typically used for de-serializing a wxFont object
957 previously saved in a string-form.
958
959 @return @true if the creation was successful.
3c4f71cc 960
4cc4bfaf 961 @see SetNativeFontInfoUserDesc()
23324ae1
FM
962 */
963 bool SetNativeFontInfo(const wxString& info);
964
965 /**
966 Creates the font corresponding to the given native font description string and
0b70c946 967 returns @true if the creation was successful.
3c4f71cc 968
0b70c946
FM
969 Unlike SetNativeFontInfo(), this function accepts strings which are user-friendly.
970 Examples of accepted string formats are:
3c4f71cc 971
0b70c946
FM
972 @beginTable
973 @hdr3col{platform, generic syntax, example}
a349dc10 974 @row3col{wxGTK2, <tt>[underlined] [strikethrough] [FACE-NAME] [bold] [oblique|italic] [POINTSIZE]</tt>, Monospace bold 10}
b5791cc7 975 @row3col{wxMSW, <tt>[light|bold] [italic] [FACE-NAME] [POINTSIZE] [ENCODING]</tt>, Tahoma 10 WINDOWS-1252}
0b70c946 976 @endTable
3c4f71cc 977
0b70c946 978 @todo add an example for wxMac
3c4f71cc 979
23324ae1 980 For more detailed information about the allowed syntaxes you can look at the
0b70c946 981 documentation of the native API used for font-rendering
a349dc10
VZ
982 (e.g. @c pango_font_description_from_string under GTK, although notice
983 that it doesn't support the "underlined" and "strikethrough" attributes
984 and so those are handled by wxWidgets itself).
f76c0758 985
a912ea26
FM
986 Note that unlike SetNativeFontInfo(), this function doesn't always restore all
987 attributes of the wxFont object under all platforms; e.g. on wxMSW the font family
988 is not restored (because GetNativeFontInfoUserDesc doesn't return it on wxMSW).
989 If you want to serialize/deserialize a font in string form, you should use
990 GetNativeFontInfoDesc() and SetNativeFontInfo() instead.
3c4f71cc 991
4cc4bfaf 992 @see SetNativeFontInfo()
23324ae1
FM
993 */
994 bool SetNativeFontInfoUserDesc(const wxString& info);
995
d775ec48
RD
996 void SetNativeFontInfo(const wxNativeFontInfo& info);
997
23324ae1
FM
998 /**
999 Sets the point size.
f76c0758 1000
b960795e 1001 The <em>point size</em> is defined as 1/72 of the Anglo-Saxon inch
f76c0758 1002 (25.4 mm): it is approximately 0.0139 inch or 352.8 um.
3c4f71cc 1003
7c913512 1004 @param pointSize
4cc4bfaf 1005 Size in points.
3c4f71cc 1006
4cc4bfaf 1007 @see GetPointSize()
23324ae1 1008 */
adaaa686 1009 virtual void SetPointSize(int pointSize);
23324ae1 1010
b5791cc7
FM
1011 /**
1012 Sets the pixel size.
f76c0758 1013
b5791cc7
FM
1014 The height parameter of @a pixelSize must be positive while the width
1015 parameter may also be zero (to indicate that you're not interested in the
1016 width of the characters: a suitable width will be chosen for best rendering).
f76c0758
VZ
1017
1018 This feature (specifying the font pixel size) is directly supported only
1019 under wxMSW and wxGTK currently; under other platforms a font with the
b5791cc7
FM
1020 closest size to the given one is found using binary search (this maybe slower).
1021
1022 @see GetPixelSize()
1023 */
1024 virtual void SetPixelSize(const wxSize& pixelSize);
f76c0758 1025
23324ae1
FM
1026 /**
1027 Sets the font style.
3c4f71cc 1028
7c913512 1029 @param style
0b70c946 1030 One of the ::wxFontStyle enumeration values.
3c4f71cc 1031
4cc4bfaf 1032 @see GetStyle()
23324ae1 1033 */
a44f3b5a 1034 virtual void SetStyle(wxFontStyle style);
23324ae1 1035
19da7aaa
VZ
1036 /**
1037 Sets the font size using a predefined symbolic size name.
1038
1039 This function allows to change font size to be (very) large or small
1040 compared to the standard font size.
1041
1042 @see SetSymbolicSizeRelativeTo().
1043
1044 @since 2.9.2
1045 */
1046 void SetSymbolicSize(wxFontSymbolicSize size);
1047
1048 /**
1049 Sets the font size compared to the base font size.
1050
1051 This is the same as SetSymbolicSize() except that it uses the given
1052 font size as the normal font size instead of the standard font size.
1053
1054 @since 2.9.2
1055 */
1056 void SetSymbolicSizeRelativeTo(wxFontSymbolicSize size, int base);
1057
23324ae1
FM
1058 /**
1059 Sets underlining.
3c4f71cc 1060
45a591fa 1061 @param underlined
4cc4bfaf 1062 @true to underline, @false otherwise.
3c4f71cc 1063
4cc4bfaf 1064 @see GetUnderlined()
23324ae1 1065 */
26818748 1066 virtual void SetUnderlined(bool underlined);
23324ae1 1067
c7a49742
VZ
1068 /**
1069 Sets strike-through attribute of the font.
1070
1071 Currently stricken-through fonts are only supported in wxMSW and wxGTK.
1072
1073 @param strikethrough
1074 @true to add strike-through style, @false to remove it.
1075
1076 @see GetStrikethrough()
1077
1078 @since 2.9.4
1079 */
1080 virtual void SetStrikethrough(bool strikethrough);
1081
23324ae1
FM
1082 /**
1083 Sets the font weight.
3c4f71cc 1084
7c913512 1085 @param weight
0b70c946 1086 One of the ::wxFontWeight values.
3c4f71cc 1087
4cc4bfaf 1088 @see GetWeight()
23324ae1 1089 */
a44f3b5a 1090 virtual void SetWeight(wxFontWeight weight);
f76c0758 1091
060c4f90
FM
1092 //@}
1093
23324ae1
FM
1094
1095 /**
1096 Inequality operator.
0b70c946 1097
674d80a7 1098 See @ref overview_refcount_equality "reference-counted object comparison" for
23324ae1
FM
1099 more info.
1100 */
fadc2df6 1101 bool operator!=(const wxFont& font) const;
23324ae1 1102
23324ae1
FM
1103 /**
1104 Equality operator.
0b70c946 1105
674d80a7 1106 See @ref overview_refcount_equality "reference-counted object comparison" for
23324ae1
FM
1107 more info.
1108 */
fadc2df6 1109 bool operator==(const wxFont& font) const;
0b70c946
FM
1110
1111 /**
1112 Assignment operator, using @ref overview_refcount "reference counting".
1113 */
1114 wxFont& operator =(const wxFont& font);
f76c0758
VZ
1115
1116
060c4f90
FM
1117 // statics
1118
1119 /**
1120 Returns the current application's default encoding.
1121
1122 @see @ref overview_fontencoding, SetDefaultEncoding()
1123 */
1124 static wxFontEncoding GetDefaultEncoding();
1125
1126 /**
1127 Sets the default font encoding.
1128
1129 @see @ref overview_fontencoding, GetDefaultEncoding()
1130 */
1131 static void SetDefaultEncoding(wxFontEncoding encoding);
f76c0758 1132
060c4f90
FM
1133 //@{
1134 /**
1135 This function takes the same parameters as the relative
1136 @ref wxFont::wxFont "wxFont constructor" and returns a new font
1137 object allocated on the heap.
b960795e
VZ
1138
1139 Their use is discouraged, use wxFont constructor from wxFontInfo
1140 instead.
060c4f90
FM
1141 */
1142 static wxFont* New(int pointSize, wxFontFamily family, wxFontStyle style,
1143 wxFontWeight weight,
1144 bool underline = false,
1145 const wxString& faceName = wxEmptyString,
1146 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
1147 static wxFont* New(int pointSize, wxFontFamily family,
1148 int flags = wxFONTFLAG_DEFAULT,
1149 const wxString& faceName = wxEmptyString,
1150 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
1151 static wxFont* New(const wxSize& pixelSize,
1152 wxFontFamily family,
1153 wxFontStyle style,
1154 wxFontWeight weight,
1155 bool underline = false,
1156 const wxString& faceName = wxEmptyString,
1157 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
1158 static wxFont* New(const wxSize& pixelSize,
1159 wxFontFamily family,
1160 int flags = wxFONTFLAG_DEFAULT,
1161 const wxString& faceName = wxEmptyString,
1162 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
d775ec48
RD
1163
1164
1165 static wxFont *New(const wxNativeFontInfo& nativeInfo);
1166 static wxFont *New(const wxString& nativeInfoString);
1167
060c4f90 1168 //@}
23324ae1 1169};
e54c96f1
FM
1170
1171
1172/**
65874118 1173 An empty wxFont.
e54c96f1 1174*/
7fa7088e 1175wxFont wxNullFont;
e54c96f1
FM
1176
1177/**
0b70c946 1178 Equivalent to wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).
f76c0758 1179
b5791cc7 1180 @see wxSystemSettings
e54c96f1 1181*/
e2e19a29 1182wxFont* wxNORMAL_FONT;
e54c96f1
FM
1183
1184/**
b5791cc7 1185 A font using the @c wxFONTFAMILY_SWISS family and 2 points smaller than
0b70c946 1186 ::wxNORMAL_FONT.
e54c96f1 1187*/
e2e19a29 1188wxFont* wxSMALL_FONT;
e54c96f1
FM
1189
1190/**
b5791cc7 1191 A font using the @c wxFONTFAMILY_ROMAN family and @c wxFONTSTYLE_ITALIC style and
0b70c946 1192 of the same size of ::wxNORMAL_FONT.
e54c96f1 1193*/
e2e19a29 1194wxFont* wxITALIC_FONT;
e54c96f1
FM
1195
1196/**
0b70c946 1197 A font identic to ::wxNORMAL_FONT except for the family used which is
b5791cc7 1198 @c wxFONTFAMILY_SWISS.
e54c96f1 1199*/
e2e19a29 1200wxFont* wxSWISS_FONT;
7fa7088e
BP
1201
1202
65874118
FM
1203/**
1204 @class wxFontList
65874118 1205
0b70c946
FM
1206 A font list is a list containing all fonts which have been created.
1207 There is only one instance of this class: ::wxTheFontList.
1208
1209 Use this object to search for a previously created font of the desired type
1210 and create it if not already found.
1211
65874118
FM
1212 In some windowing systems, the font may be a scarce resource, so it is best to
1213 reuse old resources if possible. When an application finishes, all fonts will
0b70c946 1214 be deleted and their resources freed, eliminating the possibility of 'memory
65874118
FM
1215 leaks'.
1216
1217 @library{wxcore}
1218 @category{gdi}
1219
1220 @see wxFont
1221*/
d4cb6241 1222class wxFontList
65874118
FM
1223{
1224public:
1225 /**
1226 Constructor. The application should not construct its own font list:
0b70c946 1227 use the object pointer ::wxTheFontList.
65874118
FM
1228 */
1229 wxFontList();
1230
1231 /**
1232 Finds a font of the given specification, or creates one and adds it to the
0b70c946 1233 list. See the @ref wxFont "wxFont constructor" for details of the arguments.
65874118 1234 */
a44f3b5a
FM
1235 wxFont* FindOrCreateFont(int point_size, wxFontFamily family, wxFontStyle style,
1236 wxFontWeight weight, bool underline = false,
1237 const wxString& facename = wxEmptyString,
65874118
FM
1238 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
1239};
1240
1241
0b70c946
FM
1242/**
1243 The global wxFontList instance.
1244*/
1245wxFontList* wxTheFontList;
1246
7fa7088e
BP
1247
1248// ============================================================================
1249// Global functions/macros
1250// ============================================================================
1251
b21126db 1252/** @addtogroup group_funcmacro_misc */
7fa7088e 1253//@{
e54c96f1
FM
1254
1255/**
7fa7088e
BP
1256 Converts string to a wxFont best represented by the given string. Returns
1257 @true on success.
1258
1259 @see wxToString(const wxFont&)
1260
1261 @header{wx/font.h}
e54c96f1 1262*/
7fa7088e 1263bool wxFromString(const wxString& string, wxFont* font);
e54c96f1
FM
1264
1265/**
7fa7088e
BP
1266 Converts the given wxFont into a string.
1267
1268 @see wxFromString(const wxString&, wxFont*)
1269
1270 @header{wx/font.h}
e54c96f1 1271*/
7fa7088e 1272wxString wxToString(const wxFont& font);
e54c96f1 1273
7fa7088e 1274//@}
e54c96f1 1275