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