1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403
|
<HTML>
<head><title>wxFont</title></head>
<BODY BGCOLOR=#FFFFFF>
<A NAME="wxfont"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx22.htm#classref"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx99.htm#wxfocusevent"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx101.htm#wxfontdata"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>
<H2>wxFont</H2>
<P>
A font is an object which determines the appearance of text. Fonts are
used for drawing text to a device context, and setting the appearance of
a window's text.<P>
<B><FONT COLOR="#FF0000">Derived from</FONT></B><P>
<A HREF="wx107.htm#wxgdiobject">wxGDIObject</A><BR>
<A HREF="wx158.htm#wxobject">wxObject</A><P>
<B><FONT COLOR="#FF0000">Include files</FONT></B><P>
<wx/font.h><P>
<B><FONT COLOR="#FF0000">Predefined objects</FONT></B><P>
Objects:<P>
<B>wxNullFont</B><P>
Pointers:<P>
<B>wxNORMAL_FONT<BR>
wxSMALL_FONT<BR>
wxITALIC_FONT<BR>
wxSWISS_FONT</B><P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx286.htm#wxfontoverview">wxFont overview</A>, <A HREF="wx65.htm#wxdcsetfont">wxDC::SetFont</A>,
<A HREF="wx65.htm#wxdcdrawtext">wxDC::DrawText</A>, <A HREF="wx65.htm#wxdcgettextextent">wxDC::GetTextExtent</A>,
<A HREF="wx102.htm#wxfontdialog">wxFontDialog</A><P>
<B><FONT COLOR="#FF0000">Members</FONT></B><P>
<A HREF="#wxfontconstr">wxFont::wxFont</A><BR>
<A HREF="#topic387">wxFont::~wxFont</A><BR>
<A HREF="#wxfontgetfacename">wxFont::GetFaceName</A><BR>
<A HREF="#wxfontgetfamily">wxFont::GetFamily</A><BR>
<A HREF="#wxfontgetfontid">wxFont::GetFontId</A><BR>
<A HREF="#wxfontgetpointsize">wxFont::GetPointSize</A><BR>
<A HREF="#wxfontgetstyle">wxFont::GetStyle</A><BR>
<A HREF="#wxfontgetunderlined">wxFont::GetUnderlined</A><BR>
<A HREF="#wxfontgetweight">wxFont::GetWeight</A><BR>
<A HREF="#wxfontsetfacename">wxFont::SetFaceName</A><BR>
<A HREF="#wxfontsetfamily">wxFont::SetFamily</A><BR>
<A HREF="#wxfontsetpointsize">wxFont::SetPointSize</A><BR>
<A HREF="#wxfontsetstyle">wxFont::SetStyle</A><BR>
<A HREF="#wxfontsetunderlined">wxFont::SetUnderlined</A><BR>
<A HREF="#wxfontsetweight">wxFont::SetWeight</A><BR>
<A HREF="#wxfontassignment">wxFont::operator =</A><BR>
<A HREF="#wxfontequals">wxFont::operator ==</A><BR>
<A HREF="#wxfontnotequals">wxFont::operator !=</A><BR>
<P>
<HR>
<A NAME="wxfontconstr"></A>
<H3>wxFont::wxFont</H3>
<P>
<B></B> <B>wxFont</B>()<P>
Default constructor.<P>
<B></B> <B>wxFont</B>(<B>int</B><I> pointSize</I>, <B>int</B><I> family</I>, <B>int</B><I> style</I>, <B>int</B><I> weight</I>,
<B>const bool</B><I> underline = FALSE</I>, <B>const wxString& </B><I>faceName = ""</I>)<P>
Creates a font object.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>pointSize</I><UL><UL>
Size in points.</UL></UL>
<P>
<I>family</I><UL><UL>
Font family, a generic way of referring to fonts without specifying actual facename. One of:<P>
<TABLE>
<TR><TD VALIGN=TOP>
<B>wxDEFAULT</B>
</TD>
<TD VALIGN=TOP>
Chooses a default font.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxDECORATIVE</B>
</TD>
<TD VALIGN=TOP>
A decorative font.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxROMAN</B>
</TD>
<TD VALIGN=TOP>
A formal, serif font.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxSCRIPT</B>
</TD>
<TD VALIGN=TOP>
A handwriting font.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxSWISS</B>
</TD>
<TD VALIGN=TOP>
A sans-serif font.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxMODERN</B>
</TD>
<TD VALIGN=TOP>
A fixed pitch font.
</TD></TR>
</TABLE>
</UL></UL>
<P>
<I>style</I><UL><UL>
One of <B>wxNORMAL</B>, <B>wxSLANT</B> and <B>wxITALIC</B>.</UL></UL>
<P>
<I>weight</I><UL><UL>
One of <B>wxNORMAL</B>, <B>wxLIGHT</B> and <B>wxBOLD</B>.</UL></UL>
<P>
<I>underline</I><UL><UL>
The value can be TRUE or FALSE. At present this has an effect on Windows only.</UL></UL>
<P>
<I>faceName</I><UL><UL>
An optional string specifying the actual typeface to be used. If the empty string,
a default typeface will chosen based on the family.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
If the desired font does not exist, the closest match will be chosen.
Under Windows, only scaleable TrueType fonts are used.<P>
Underlining only works under Windows at present.<P>
See also <A HREF="wx65.htm#wxdcsetfont">wxDC::SetFont</A>, <A HREF="wx65.htm#wxdcdrawtext">wxDC::DrawText</A>
and <A HREF="wx65.htm#wxdcgettextextent">wxDC::GetTextExtent</A>.<P>
<HR>
<A NAME="topic387"></A>
<H3>wxFont::~wxFont</H3>
<P>
<B></B> <B>~wxFont</B>()<P>
Destructor.<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
The destructor may not delete the underlying font object of the native windowing
system, since wxBrush uses a reference counting system for efficiency.<P>
Although all remaining fonts are deleted when the application exits,
the application should try to clean up all fonts itself. This is because
wxWindows cannot know if a pointer to the font object is stored in an
application data structure, and there is a risk of double deletion.<P>
<HR>
<A NAME="wxfontgetfacename"></A>
<H3>wxFont::GetFaceName</H3>
<P>
<B>wxString</B> <B>GetFaceName</B>() <B>const</B><P>
Returns the typeface name associated with the font, or the empty string if there is no
typeface information.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx100.htm#wxfontsetfacename">wxFont::SetFaceName</A><P>
<HR>
<A NAME="wxfontgetfamily"></A>
<H3>wxFont::GetFamily</H3>
<P>
<B>int</B> <B>GetFamily</B>() <B>const</B><P>
Gets the font family. See <A HREF="wx100.htm#wxfontconstr">wxFont::wxFont</A> for a list of valid
family identifiers.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx100.htm#wxfontsetfamily">wxFont::SetFamily</A><P>
<HR>
<A NAME="wxfontgetfontid"></A>
<H3>wxFont::GetFontId</H3>
<P>
<B>int</B> <B>GetFontId</B>() <B>const</B><P>
Returns the font id, if the portable font system is in operation. See <A HREF="wx286.htm#wxfontoverview">Font overview</A> for
further details.<P>
<HR>
<A NAME="wxfontgetpointsize"></A>
<H3>wxFont::GetPointSize</H3>
<P>
<B>int</B> <B>GetPointSize</B>() <B>const</B><P>
Gets the point size.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx100.htm#wxfontsetpointsize">wxFont::SetPointSize</A><P>
<HR>
<A NAME="wxfontgetstyle"></A>
<H3>wxFont::GetStyle</H3>
<P>
<B>int</B> <B>GetStyle</B>() <B>const</B><P>
Gets the font style. See <A HREF="wx100.htm#wxfontconstr">wxFont::wxFont</A> for a list of valid
styles.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx100.htm#wxfontsetstyle">wxFont::SetStyle</A><P>
<HR>
<A NAME="wxfontgetunderlined"></A>
<H3>wxFont::GetUnderlined</H3>
<P>
<B>bool</B> <B>GetUnderlined</B>() <B>const</B><P>
Returns TRUE if the font is underlined, FALSE otherwise.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx100.htm#wxfontsetunderlined">wxFont::SetUnderlined</A><P>
<HR>
<A NAME="wxfontgetweight"></A>
<H3>wxFont::GetWeight</H3>
<P>
<B>int</B> <B>GetWeight</B>() <B>const</B><P>
Gets the font weight. See <A HREF="wx100.htm#wxfontconstr">wxFont::wxFont</A> for a list of valid
weight identifiers.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx100.htm#wxfontsetweight">wxFont::SetWeight</A><P>
<HR>
<A NAME="wxfontsetfacename"></A>
<H3>wxFont::SetFaceName</H3>
<P>
<B>void</B> <B>SetFaceName</B>(<B>const wxString& </B><I>faceName</I>)<P>
Sets the facename for the font.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>faceName</I><UL><UL>
A valid facename, which should be on the end-user's system.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
To avoid portability problems, don't rely on a specific face, but specify the font family
instead or as well. A suitable font will be found on the end-user's system. If both the
family and the facename are specified, wxWindows will first search for the specific face,
and then for a font belonging to the same family.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx100.htm#wxfontgetfacename">wxFont::GetFaceName</A>, <A HREF="wx100.htm#wxfontsetfamily">wxFont::SetFamily</A><P>
<HR>
<A NAME="wxfontsetfamily"></A>
<H3>wxFont::SetFamily</H3>
<P>
<B>void</B> <B>SetFamily</B>(<B>int</B><I> family</I>)<P>
Sets the font family.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>family</I><UL><UL>
One of:<P>
<TABLE>
<TR><TD VALIGN=TOP>
<B>wxDEFAULT</B>
</TD>
<TD VALIGN=TOP>
Chooses a default font.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxDECORATIVE</B>
</TD>
<TD VALIGN=TOP>
A decorative font.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxROMAN</B>
</TD>
<TD VALIGN=TOP>
A formal, serif font.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxSCRIPT</B>
</TD>
<TD VALIGN=TOP>
A handwriting font.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxSWISS</B>
</TD>
<TD VALIGN=TOP>
A sans-serif font.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxMODERN</B>
</TD>
<TD VALIGN=TOP>
A fixed pitch font.
</TD></TR>
</TABLE>
</UL></UL>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx100.htm#wxfontgetfamily">wxFont::GetFamily</A>, <A HREF="wx100.htm#wxfontsetfacename">wxFont::SetFaceName</A><P>
<HR>
<A NAME="wxfontsetpointsize"></A>
<H3>wxFont::SetPointSize</H3>
<P>
<B>void</B> <B>SetPointSize</B>(<B>int</B><I> pointSize</I>)<P>
Sets the point size.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>pointSize</I><UL><UL>
Size in points.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx100.htm#wxfontgetpointsize">wxFont::GetPointSize</A><P>
<HR>
<A NAME="wxfontsetstyle"></A>
<H3>wxFont::SetStyle</H3>
<P>
<B>void</B> <B>SetStyle</B>(<B>int</B><I> style</I>)<P>
Sets the font style.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>style</I><UL><UL>
One of <B>wxNORMAL</B>, <B>wxSLANT</B> and <B>wxITALIC</B>.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx100.htm#wxfontgetstyle">wxFont::GetStyle</A><P>
<HR>
<A NAME="wxfontsetunderlined"></A>
<H3>wxFont::SetUnderlined</H3>
<P>
<B>void</B> <B>SetUnderlined</B>(<B>const bool</B><I> underlined</I>)<P>
Sets underlining.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>underlining</I><UL><UL>
TRUE to underline, FALSE otherwise.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx100.htm#wxfontgetunderlined">wxFont::GetUnderlined</A><P>
<HR>
<A NAME="wxfontsetweight"></A>
<H3>wxFont::SetWeight</H3>
<P>
<B>void</B> <B>SetWeight</B>(<B>int</B><I> weight</I>)<P>
Sets the font weight.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>weight</I><UL><UL>
One of <B>wxNORMAL</B>, <B>wxLIGHT</B> and <B>wxBOLD</B>.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx100.htm#wxfontgetweight">wxFont::GetWeight</A><P>
<HR>
<A NAME="wxfontassignment"></A>
<H3>wxFont::operator =</H3>
<P>
<B>wxFont&</B> <B>operator =</B>(<B>const wxFont& </B><I>font</I>)<P>
Assignment operator, using reference counting. Returns a reference
to 'this'.<P>
<HR>
<A NAME="wxfontequals"></A>
<H3>wxFont::operator ==</H3>
<P>
<B>bool</B> <B>operator ==</B>(<B>const wxFont& </B><I>font</I>)<P>
Equality operator. Two fonts are equal if they contain pointers
to the same underlying font data. It does not compare each attribute,
so two indefontdently-created fonts using the same parameters will
fail the test.<P>
<HR>
<A NAME="wxfontnotequals"></A>
<H3>wxFont::operator !=</H3>
<P>
<B>bool</B> <B>operator !=</B>(<B>const wxFont& </B><I>font</I>)<P>
Inequality operator. Two fonts are not equal if they contain pointers
to different underlying font data. It does not compare each attribute.<P>
</BODY></HTML>
|