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