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