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