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