]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/font.tex
1. added code to dyntbar to allow bitmap loading from windows resources
[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
20e85460
JS
16\wxheading{Predefined objects}
17
18Objects:
19
20{\bf wxNullFont}
21
22Pointers:
23
24{\bf wxNORMAL\_FONT\\
25wxSMALL\_FONT\\
26wxITALIC\_FONT\\
27wxSWISS\_FONT}
28
a660d684
KB
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
41Default constructor.
42
eaaa6a06 43\func{}{wxFont}{\param{int}{ pointSize}, \param{int}{ family}, \param{int}{ style}, \param{int}{ weight},
a660d684
KB
44 \param{const bool}{ underline = FALSE}, \param{const wxString\& }{faceName = ""}}
45
46Creates 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,
71a default typeface will chosen based on the family.}
72
73\wxheading{Remarks}
74
75If the desired font does not exist, the closest match will be chosen.
76Under Windows, only scaleable TrueType fonts are used.
77
78Underlining only works under Windows at present.
79
80See also \helpref{wxDC::SetFont}{wxdcsetfont}, \helpref{wxDC::DrawText}{wxdcdrawtext}
81and \helpref{wxDC::GetTextExtent}{wxdcgettextextent}.
82
83\membersection{wxFont::\destruct{wxFont}}
84
85\func{}{\destruct{wxFont}}{\void}
86
87Destructor.
88
89\wxheading{Remarks}
90
91The destructor may not delete the underlying font object of the native windowing
92system, since wxBrush uses a reference counting system for efficiency.
93
94Although all remaining fonts are deleted when the application exits,
95the application should try to clean up all fonts itself. This is because
96wxWindows cannot know if a pointer to the font object is stored in an
97application data structure, and there is a risk of double deletion.
98
99\membersection{wxFont::GetFaceName}\label{wxfontgetfacename}
100
101\constfunc{wxString}{GetFaceName}{\void}
102
103Returns the typeface name associated with the font, or the empty string if there is no
104typeface 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
114Gets the font family. See \helpref{wxFont::wxFont}{wxfontconstr} for a list of valid
115family 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
125Returns the font id, if the portable font system is in operation. See \helpref{Font overview}{wxfontoverview} for
126further details.
127
128\membersection{wxFont::GetPointSize}\label{wxfontgetpointsize}
129
130\constfunc{int}{GetPointSize}{\void}
131
132Gets 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
142Gets the font style. See \helpref{wxFont::wxFont}{wxfontconstr} for a list of valid
143styles.
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
153Returns 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
163Gets the font weight. See \helpref{wxFont::wxFont}{wxfontconstr} for a list of valid
164weight 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
174Sets 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
182To avoid portability problems, don't rely on a specific face, but specify the font family
183instead or as well. A suitable font will be found on the end-user's system. If both the
184family and the facename are specified, wxWindows will first search for the specific face,
185and 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
eaaa6a06 193\func{void}{SetFamily}{\param{int}{ family}}
a660d684
KB
194
195Sets 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
eaaa6a06 217\func{void}{SetPointSize}{\param{int}{ pointSize}}
a660d684
KB
218
219Sets 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
eaaa6a06 231\func{void}{SetStyle}{\param{int}{ style}}
a660d684
KB
232
233Sets 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
247Sets 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
eaaa6a06 259\func{void}{SetWeight}{\param{int}{ weight}}
a660d684
KB
260
261Sets 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
275Assignment operator, using reference counting. Returns a reference
276to `this'.
277
278\membersection{wxFont::operator $==$}\label{wxfontequals}
279
280\func{bool}{operator $==$}{\param{const wxFont\& }{font}}
281
282Equality operator. Two fonts are equal if they contain pointers
283to the same underlying font data. It does not compare each attribute,
284so two indefontdently-created fonts using the same parameters will
285fail the test.
286
287\membersection{wxFont::operator $!=$}\label{wxfontnotequals}
288
289\func{bool}{operator $!=$}{\param{const wxFont\& }{font}}
290
291Inequality operator. Two fonts are not equal if they contain pointers
292to different underlying font data. It does not compare each attribute.
293
294