]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/font.tex
Added EVT_GRID_EDITOR_CREATED and wxGridEditorCreatedEvent so the user
[wxWidgets.git] / docs / latex / wx / font.tex
CommitLineData
a660d684
KB
1\section{\class{wxFont}}\label{wxfont}
2
3A font is an object which determines the appearance of text. Fonts are
4used for drawing text to a device context, and setting the appearance of
5a window's text.
6
7\wxheading{Derived from}
8
9\helpref{wxGDIObject}{wxgdiobject}\\
10\helpref{wxObject}{wxobject}
11
954b8ae6
JS
12\wxheading{Include files}
13
14<wx/font.h>
15
20e85460
JS
16\wxheading{Predefined objects}
17
18Objects:
19
20{\bf wxNullFont}
21
22Pointers:
23
24{\bf wxNORMAL\_FONT\\
25wxSMALL\_FONT\\
26wxITALIC\_FONT\\
27wxSWISS\_FONT}
28
a660d684
KB
29\wxheading{See also}
30
31\helpref{wxFont overview}{wxfontoverview}, \helpref{wxDC::SetFont}{wxdcsetfont},\rtfsp
32\helpref{wxDC::DrawText}{wxdcdrawtext}, \helpref{wxDC::GetTextExtent}{wxdcgettextextent},\rtfsp
33\helpref{wxFontDialog}{wxfontdialog}
34
35\latexignore{\rtfignore{\wxheading{Members}}}
36
37\membersection{wxFont::wxFont}\label{wxfontconstr}
38
39\func{}{wxFont}{\void}
40
41Default constructor.
42
eaaa6a06 43\func{}{wxFont}{\param{int}{ pointSize}, \param{int}{ family}, \param{int}{ style}, \param{int}{ weight},
0c5d3e1c
VZ
44 \param{const bool}{ underline = FALSE}, \param{const wxString\& }{faceName = ""},
45 \param{wxFontEncoding }{encoding = wxFONTENCODING\_DEFAULT}}
a660d684 46
775a998e
VZ
47Creates a font object (see \helpref{font encoding
48overview}{wxfontencodingoverview} for the meaning of the last parameter).
a660d684
KB
49
50\wxheading{Parameters}
51
52\docparam{pointSize}{Size in points.}
53
54\docparam{family}{Font family, a generic way of referring to fonts without specifying actual facename. One of:
55
56\twocolwidtha{5cm}
57\begin{twocollist}\itemsep=0pt
58\twocolitem{{\bf wxDEFAULT}}{Chooses a default font.}
59\twocolitem{{\bf wxDECORATIVE}}{A decorative font.}
60\twocolitem{{\bf wxROMAN}}{A formal, serif font.}
61\twocolitem{{\bf wxSCRIPT}}{A handwriting font.}
62\twocolitem{{\bf wxSWISS}}{A sans-serif font.}
63\twocolitem{{\bf wxMODERN}}{A fixed pitch font.}
64\end{twocollist}}
65
66\docparam{style}{One of {\bf wxNORMAL}, {\bf wxSLANT} and {\bf wxITALIC}.}
67
68\docparam{weight}{One of {\bf wxNORMAL}, {\bf wxLIGHT} and {\bf wxBOLD}.}
69
70\docparam{underline}{The value can be TRUE or FALSE. At present this has an effect on Windows only.}
71
72\docparam{faceName}{An optional string specifying the actual typeface to be used. If the empty string,
73a default typeface will chosen based on the family.}
74
0c5d3e1c
VZ
75\docparam{encoding}{An encoding which may be one of
76\twocolwidtha{5cm}
77\begin{twocollist}\itemsep=0pt
78\twocolitem{{\bf wxFONTENCODING\_SYSTEM}}{Default system encoding.}
79\twocolitem{{\bf wxFONTENCODING\_DEFAULT}}{Default application encoding: this
80is the encoding set by calls to
88b1927c 81\helpref{SetDefaultEncoding}{wxfontsetdefaultencoding} and which may be set to,
0c5d3e1c
VZ
82say, KOI8 to create all fonts by default with KOI8 encoding. Initially, the
83default application encoding is the same as default system encoding.}
84\twocolitem{{\bf wxFONTENCODING\_ISO8859\_1...15}}{ISO8859 encodings.}
85\twocolitem{{\bf wxFONTENCODING\_KOI8}}{The standard russian encoding for Internet.}
86\twocolitem{{\bf wxFONTENCODING\_CP1250...1252}}{Windows encodings similar to ISO8859 (but not identical).}
87\end{twocollist}
88If the specified encoding isn't available, no font is created.
89}
90
a660d684
KB
91\wxheading{Remarks}
92
93If the desired font does not exist, the closest match will be chosen.
94Under Windows, only scaleable TrueType fonts are used.
95
a660d684
KB
96See also \helpref{wxDC::SetFont}{wxdcsetfont}, \helpref{wxDC::DrawText}{wxdcdrawtext}
97and \helpref{wxDC::GetTextExtent}{wxdcgettextextent}.
98
99\membersection{wxFont::\destruct{wxFont}}
100
101\func{}{\destruct{wxFont}}{\void}
102
103Destructor.
104
105\wxheading{Remarks}
106
107The destructor may not delete the underlying font object of the native windowing
775a998e 108system, since wxFont uses a reference counting system for efficiency.
a660d684
KB
109
110Although all remaining fonts are deleted when the application exits,
111the application should try to clean up all fonts itself. This is because
112wxWindows cannot know if a pointer to the font object is stored in an
113application data structure, and there is a risk of double deletion.
114
775a998e
VZ
115\membersection{wxFont::GetDefaultEncoding}\label{wxfontgetdefaultencoding}
116
117\func{static wxFontEncoding}{GetDefaultEncoding}{\void}
118
119Returns the current applications default encoding.
120
121\wxheading{See also}
122
123\helpref{Font encoding overview}{wxfontencodingoverview},
124\helpref{SetDefaultEncoding}{wxfontsetdefaultencoding}
125
a660d684
KB
126\membersection{wxFont::GetFaceName}\label{wxfontgetfacename}
127
128\constfunc{wxString}{GetFaceName}{\void}
129
130Returns the typeface name associated with the font, or the empty string if there is no
131typeface information.
132
133\wxheading{See also}
134
135\helpref{wxFont::SetFaceName}{wxfontsetfacename}
136
137\membersection{wxFont::GetFamily}\label{wxfontgetfamily}
138
139\constfunc{int}{GetFamily}{\void}
140
141Gets the font family. See \helpref{wxFont::wxFont}{wxfontconstr} for a list of valid
142family identifiers.
143
144\wxheading{See also}
145
146\helpref{wxFont::SetFamily}{wxfontsetfamily}
147
148\membersection{wxFont::GetFontId}\label{wxfontgetfontid}
149
150\constfunc{int}{GetFontId}{\void}
151
152Returns the font id, if the portable font system is in operation. See \helpref{Font overview}{wxfontoverview} for
153further details.
154
155\membersection{wxFont::GetPointSize}\label{wxfontgetpointsize}
156
157\constfunc{int}{GetPointSize}{\void}
158
159Gets the point size.
160
161\wxheading{See also}
162
163\helpref{wxFont::SetPointSize}{wxfontsetpointsize}
164
165\membersection{wxFont::GetStyle}\label{wxfontgetstyle}
166
167\constfunc{int}{GetStyle}{\void}
168
169Gets the font style. See \helpref{wxFont::wxFont}{wxfontconstr} for a list of valid
170styles.
171
172\wxheading{See also}
173
174\helpref{wxFont::SetStyle}{wxfontsetstyle}
175
176\membersection{wxFont::GetUnderlined}\label{wxfontgetunderlined}
177
178\constfunc{bool}{GetUnderlined}{\void}
179
180Returns TRUE if the font is underlined, FALSE otherwise.
181
182\wxheading{See also}
183
184\helpref{wxFont::SetUnderlined}{wxfontsetunderlined}
185
186\membersection{wxFont::GetWeight}\label{wxfontgetweight}
187
188\constfunc{int}{GetWeight}{\void}
189
190Gets the font weight. See \helpref{wxFont::wxFont}{wxfontconstr} for a list of valid
191weight identifiers.
192
193\wxheading{See also}
194
195\helpref{wxFont::SetWeight}{wxfontsetweight}
196
88b1927c
JS
197\membersection{wxFont::SetDefaultEncoding}\label{wxfontsetdefaultencoding}
198
199\func{static void}{SetDefaultEncoding}{\param{wxFontEncoding }{encoding}}
200
201Sets the default font encoding.
202
775a998e
VZ
203\wxheading{See also}
204
205\helpref{Font encoding overview}{wxfontencodingoverview},
206\helpref{GetDefaultEncoding}{wxfontgetdefaultencoding}
207
a660d684
KB
208\membersection{wxFont::SetFaceName}\label{wxfontsetfacename}
209
210\func{void}{SetFaceName}{\param{const wxString\& }{faceName}}
211
212Sets the facename for the font.
213
214\wxheading{Parameters}
215
216\docparam{faceName}{A valid facename, which should be on the end-user's system.}
217
218\wxheading{Remarks}
219
220To avoid portability problems, don't rely on a specific face, but specify the font family
221instead or as well. A suitable font will be found on the end-user's system. If both the
222family and the facename are specified, wxWindows will first search for the specific face,
223and then for a font belonging to the same family.
224
225\wxheading{See also}
226
227\helpref{wxFont::GetFaceName}{wxfontgetfacename}, \helpref{wxFont::SetFamily}{wxfontsetfamily}
228
229\membersection{wxFont::SetFamily}\label{wxfontsetfamily}
230
eaaa6a06 231\func{void}{SetFamily}{\param{int}{ family}}
a660d684
KB
232
233Sets the font family.
234
235\wxheading{Parameters}
236
237\docparam{family}{One of:
238
239\twocolwidtha{5cm}
240\begin{twocollist}\itemsep=0pt
241\twocolitem{{\bf wxDEFAULT}}{Chooses a default font.}
242\twocolitem{{\bf wxDECORATIVE}}{A decorative font.}
243\twocolitem{{\bf wxROMAN}}{A formal, serif font.}
244\twocolitem{{\bf wxSCRIPT}}{A handwriting font.}
245\twocolitem{{\bf wxSWISS}}{A sans-serif font.}
246\twocolitem{{\bf wxMODERN}}{A fixed pitch font.}
247\end{twocollist}}
248
249\wxheading{See also}
250
251\helpref{wxFont::GetFamily}{wxfontgetfamily}, \helpref{wxFont::SetFaceName}{wxfontsetfacename}
252
253\membersection{wxFont::SetPointSize}\label{wxfontsetpointsize}
254
eaaa6a06 255\func{void}{SetPointSize}{\param{int}{ pointSize}}
a660d684
KB
256
257Sets the point size.
258
259\wxheading{Parameters}
260
261\docparam{pointSize}{Size in points.}
262
263\wxheading{See also}
264
265\helpref{wxFont::GetPointSize}{wxfontgetpointsize}
266
267\membersection{wxFont::SetStyle}\label{wxfontsetstyle}
268
eaaa6a06 269\func{void}{SetStyle}{\param{int}{ style}}
a660d684
KB
270
271Sets the font style.
272
273\wxheading{Parameters}
274
275\docparam{style}{One of {\bf wxNORMAL}, {\bf wxSLANT} and {\bf wxITALIC}.}
276
277\wxheading{See also}
278
279\helpref{wxFont::GetStyle}{wxfontgetstyle}
280
281\membersection{wxFont::SetUnderlined}\label{wxfontsetunderlined}
282
283\func{void}{SetUnderlined}{\param{const bool}{ underlined}}
284
285Sets underlining.
286
287\wxheading{Parameters}
288
289\docparam{underlining}{TRUE to underline, FALSE otherwise.}
290
291\wxheading{See also}
292
293\helpref{wxFont::GetUnderlined}{wxfontgetunderlined}
294
295\membersection{wxFont::SetWeight}\label{wxfontsetweight}
296
eaaa6a06 297\func{void}{SetWeight}{\param{int}{ weight}}
a660d684
KB
298
299Sets the font weight.
300
301\wxheading{Parameters}
302
303\docparam{weight}{One of {\bf wxNORMAL}, {\bf wxLIGHT} and {\bf wxBOLD}.}
304
305\wxheading{See also}
306
307\helpref{wxFont::GetWeight}{wxfontgetweight}
308
309\membersection{wxFont::operator $=$}\label{wxfontassignment}
310
311\func{wxFont\&}{operator $=$}{\param{const wxFont\& }{font}}
312
313Assignment operator, using reference counting. Returns a reference
314to `this'.
315
316\membersection{wxFont::operator $==$}\label{wxfontequals}
317
318\func{bool}{operator $==$}{\param{const wxFont\& }{font}}
319
320Equality operator. Two fonts are equal if they contain pointers
321to the same underlying font data. It does not compare each attribute,
322so two indefontdently-created fonts using the same parameters will
323fail the test.
324
325\membersection{wxFont::operator $!=$}\label{wxfontnotequals}
326
327\func{bool}{operator $!=$}{\param{const wxFont\& }{font}}
328
329Inequality operator. Two fonts are not equal if they contain pointers
330to different underlying font data. It does not compare each attribute.
331
332