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