]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/font.tex
wxExecute() fixes and doc updates: the return value for sync exec case is now
[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
a660d684
KB
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
28Default constructor.
29
eaaa6a06 30\func{}{wxFont}{\param{int}{ pointSize}, \param{int}{ family}, \param{int}{ style}, \param{int}{ weight},
a660d684
KB
31 \param{const bool}{ underline = FALSE}, \param{const wxString\& }{faceName = ""}}
32
33Creates 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,
58a default typeface will chosen based on the family.}
59
60\wxheading{Remarks}
61
62If the desired font does not exist, the closest match will be chosen.
63Under Windows, only scaleable TrueType fonts are used.
64
65Underlining only works under Windows at present.
66
67See also \helpref{wxDC::SetFont}{wxdcsetfont}, \helpref{wxDC::DrawText}{wxdcdrawtext}
68and \helpref{wxDC::GetTextExtent}{wxdcgettextextent}.
69
70\membersection{wxFont::\destruct{wxFont}}
71
72\func{}{\destruct{wxFont}}{\void}
73
74Destructor.
75
76\wxheading{Remarks}
77
78The destructor may not delete the underlying font object of the native windowing
79system, since wxBrush uses a reference counting system for efficiency.
80
81Although all remaining fonts are deleted when the application exits,
82the application should try to clean up all fonts itself. This is because
83wxWindows cannot know if a pointer to the font object is stored in an
84application data structure, and there is a risk of double deletion.
85
86\membersection{wxFont::GetFaceName}\label{wxfontgetfacename}
87
88\constfunc{wxString}{GetFaceName}{\void}
89
90Returns the typeface name associated with the font, or the empty string if there is no
91typeface 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
101Gets the font family. See \helpref{wxFont::wxFont}{wxfontconstr} for a list of valid
102family 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
112Returns the font id, if the portable font system is in operation. See \helpref{Font overview}{wxfontoverview} for
113further details.
114
115\membersection{wxFont::GetPointSize}\label{wxfontgetpointsize}
116
117\constfunc{int}{GetPointSize}{\void}
118
119Gets 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
129Gets the font style. See \helpref{wxFont::wxFont}{wxfontconstr} for a list of valid
130styles.
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
140Returns 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
150Gets the font weight. See \helpref{wxFont::wxFont}{wxfontconstr} for a list of valid
151weight 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
161Sets 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
169To avoid portability problems, don't rely on a specific face, but specify the font family
170instead or as well. A suitable font will be found on the end-user's system. If both the
171family and the facename are specified, wxWindows will first search for the specific face,
172and 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
eaaa6a06 180\func{void}{SetFamily}{\param{int}{ family}}
a660d684
KB
181
182Sets 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
eaaa6a06 204\func{void}{SetPointSize}{\param{int}{ pointSize}}
a660d684
KB
205
206Sets 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
eaaa6a06 218\func{void}{SetStyle}{\param{int}{ style}}
a660d684
KB
219
220Sets 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
234Sets 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
eaaa6a06 246\func{void}{SetWeight}{\param{int}{ weight}}
a660d684
KB
247
248Sets 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
262Assignment operator, using reference counting. Returns a reference
263to `this'.
264
265\membersection{wxFont::operator $==$}\label{wxfontequals}
266
267\func{bool}{operator $==$}{\param{const wxFont\& }{font}}
268
269Equality operator. Two fonts are equal if they contain pointers
270to the same underlying font data. It does not compare each attribute,
271so two indefontdently-created fonts using the same parameters will
272fail the test.
273
274\membersection{wxFont::operator $!=$}\label{wxfontnotequals}
275
276\func{bool}{operator $!=$}{\param{const wxFont\& }{font}}
277
278Inequality operator. Two fonts are not equal if they contain pointers
279to different underlying font data. It does not compare each attribute.
280
281