]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/font.tex
* Someone destroy a part of my previous work. Redocumenting ...
[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{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
24 Default constructor.
25
26 \func{}{wxFont}{\param{int}{ pointSize}, \param{int}{ family}, \param{int}{ style}, \param{int}{ weight},
27 \param{const bool}{ underline = FALSE}, \param{const wxString\& }{faceName = ""}}
28
29 Creates 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,
54 a default typeface will chosen based on the family.}
55
56 \wxheading{Remarks}
57
58 If the desired font does not exist, the closest match will be chosen.
59 Under Windows, only scaleable TrueType fonts are used.
60
61 Underlining only works under Windows at present.
62
63 See also \helpref{wxDC::SetFont}{wxdcsetfont}, \helpref{wxDC::DrawText}{wxdcdrawtext}
64 and \helpref{wxDC::GetTextExtent}{wxdcgettextextent}.
65
66 \membersection{wxFont::\destruct{wxFont}}
67
68 \func{}{\destruct{wxFont}}{\void}
69
70 Destructor.
71
72 \wxheading{Remarks}
73
74 The destructor may not delete the underlying font object of the native windowing
75 system, since wxBrush uses a reference counting system for efficiency.
76
77 Although all remaining fonts are deleted when the application exits,
78 the application should try to clean up all fonts itself. This is because
79 wxWindows cannot know if a pointer to the font object is stored in an
80 application data structure, and there is a risk of double deletion.
81
82 \membersection{wxFont::GetFaceName}\label{wxfontgetfacename}
83
84 \constfunc{wxString}{GetFaceName}{\void}
85
86 Returns the typeface name associated with the font, or the empty string if there is no
87 typeface 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
97 Gets the font family. See \helpref{wxFont::wxFont}{wxfontconstr} for a list of valid
98 family 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
108 Returns the font id, if the portable font system is in operation. See \helpref{Font overview}{wxfontoverview} for
109 further details.
110
111 \membersection{wxFont::GetPointSize}\label{wxfontgetpointsize}
112
113 \constfunc{int}{GetPointSize}{\void}
114
115 Gets 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
125 Gets the font style. See \helpref{wxFont::wxFont}{wxfontconstr} for a list of valid
126 styles.
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
136 Returns 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
146 Gets the font weight. See \helpref{wxFont::wxFont}{wxfontconstr} for a list of valid
147 weight 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
157 Sets 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
165 To avoid portability problems, don't rely on a specific face, but specify the font family
166 instead or as well. A suitable font will be found on the end-user's system. If both the
167 family and the facename are specified, wxWindows will first search for the specific face,
168 and 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
176 \func{void}{SetFamily}{\param{int}{ family}}
177
178 Sets 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
200 \func{void}{SetPointSize}{\param{int}{ pointSize}}
201
202 Sets 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
214 \func{void}{SetStyle}{\param{int}{ style}}
215
216 Sets 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
230 Sets 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
242 \func{void}{SetWeight}{\param{int}{ weight}}
243
244 Sets 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
258 Assignment operator, using reference counting. Returns a reference
259 to `this'.
260
261 \membersection{wxFont::operator $==$}\label{wxfontequals}
262
263 \func{bool}{operator $==$}{\param{const wxFont\& }{font}}
264
265 Equality operator. Two fonts are equal if they contain pointers
266 to the same underlying font data. It does not compare each attribute,
267 so two indefontdently-created fonts using the same parameters will
268 fail the test.
269
270 \membersection{wxFont::operator $!=$}\label{wxfontnotequals}
271
272 \func{bool}{operator $!=$}{\param{const wxFont\& }{font}}
273
274 Inequality operator. Two fonts are not equal if they contain pointers
275 to different underlying font data. It does not compare each attribute.
276
277