1 \section{\class{wxFont
}}\label{wxfont
}
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
7 \wxheading{Derived from
}
9 \helpref{wxGDIObject
}{wxgdiobject
}\\
10 \helpref{wxObject
}{wxobject
}
14 \helpref{wxFont overview
}{wxfontoverview
},
\helpref{wxDC::SetFont
}{wxdcsetfont
},
\rtfsp
15 \helpref{wxDC::DrawText
}{wxdcdrawtext
},
\helpref{wxDC::GetTextExtent
}{wxdcgettextextent
},
\rtfsp
16 \helpref{wxFontDialog
}{wxfontdialog
}
18 \latexignore{\rtfignore{\wxheading{Members
}}}
20 \membersection{wxFont::wxFont
}\label{wxfontconstr
}
22 \func{}{wxFont
}{\void}
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 = ""
}}
29 Creates a font object.
31 \wxheading{Parameters
}
33 \docparam{pointSize
}{Size in points.
}
35 \docparam{family
}{Font family, a generic way of referring to fonts without specifying actual facename. One of:
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.
}
47 \docparam{style
}{One of
{\bf wxNORMAL
},
{\bf wxSLANT
} and
{\bf wxITALIC
}.
}
49 \docparam{weight
}{One of
{\bf wxNORMAL
},
{\bf wxLIGHT
} and
{\bf wxBOLD
}.
}
51 \docparam{underline
}{The value can be TRUE or FALSE. At present this has an effect on Windows only.
}
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.
}
58 If the desired font does not exist, the closest match will be chosen.
59 Under Windows, only scaleable TrueType fonts are used.
61 Underlining only works under Windows at present.
63 See also
\helpref{wxDC::SetFont
}{wxdcsetfont
},
\helpref{wxDC::DrawText
}{wxdcdrawtext
}
64 and
\helpref{wxDC::GetTextExtent
}{wxdcgettextextent
}.
66 \membersection{wxFont::
\destruct{wxFont
}}
68 \func{}{\destruct{wxFont
}}{\void}
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.
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.
82 \membersection{wxFont::GetFaceName
}\label{wxfontgetfacename
}
84 \constfunc{wxString
}{GetFaceName
}{\void}
86 Returns the typeface name associated with the font, or the empty string if there is no
91 \helpref{wxFont::SetFaceName
}{wxfontsetfacename
}
93 \membersection{wxFont::GetFamily
}\label{wxfontgetfamily
}
95 \constfunc{int
}{GetFamily
}{\void}
97 Gets the font family. See
\helpref{wxFont::wxFont
}{wxfontconstr
} for a list of valid
102 \helpref{wxFont::SetFamily
}{wxfontsetfamily
}
104 \membersection{wxFont::GetFontId
}\label{wxfontgetfontid
}
106 \constfunc{int
}{GetFontId
}{\void}
108 Returns the font id, if the portable font system is in operation. See
\helpref{Font overview
}{wxfontoverview
} for
111 \membersection{wxFont::GetPointSize
}\label{wxfontgetpointsize
}
113 \constfunc{int
}{GetPointSize
}{\void}
119 \helpref{wxFont::SetPointSize
}{wxfontsetpointsize
}
121 \membersection{wxFont::GetStyle
}\label{wxfontgetstyle
}
123 \constfunc{int
}{GetStyle
}{\void}
125 Gets the font style. See
\helpref{wxFont::wxFont
}{wxfontconstr
} for a list of valid
130 \helpref{wxFont::SetStyle
}{wxfontsetstyle
}
132 \membersection{wxFont::GetUnderlined
}\label{wxfontgetunderlined
}
134 \constfunc{bool
}{GetUnderlined
}{\void}
136 Returns TRUE if the font is underlined, FALSE otherwise.
140 \helpref{wxFont::SetUnderlined
}{wxfontsetunderlined
}
142 \membersection{wxFont::GetWeight
}\label{wxfontgetweight
}
144 \constfunc{int
}{GetWeight
}{\void}
146 Gets the font weight. See
\helpref{wxFont::wxFont
}{wxfontconstr
} for a list of valid
151 \helpref{wxFont::SetWeight
}{wxfontsetweight
}
153 \membersection{wxFont::SetFaceName
}\label{wxfontsetfacename
}
155 \func{void
}{SetFaceName
}{\param{const wxString\&
}{faceName
}}
157 Sets the facename for the font.
159 \wxheading{Parameters
}
161 \docparam{faceName
}{A valid facename, which should be on the end-user's system.
}
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.
172 \helpref{wxFont::GetFaceName
}{wxfontgetfacename
},
\helpref{wxFont::SetFamily
}{wxfontsetfamily
}
174 \membersection{wxFont::SetFamily
}\label{wxfontsetfamily
}
176 \func{void
}{SetFamily
}{\param{int
}{ family
}}
178 Sets the font family.
180 \wxheading{Parameters
}
182 \docparam{family
}{One of:
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.
}
196 \helpref{wxFont::GetFamily
}{wxfontgetfamily
},
\helpref{wxFont::SetFaceName
}{wxfontsetfacename
}
198 \membersection{wxFont::SetPointSize
}\label{wxfontsetpointsize
}
200 \func{void
}{SetPointSize
}{\param{int
}{ pointSize
}}
204 \wxheading{Parameters
}
206 \docparam{pointSize
}{Size in points.
}
210 \helpref{wxFont::GetPointSize
}{wxfontgetpointsize
}
212 \membersection{wxFont::SetStyle
}\label{wxfontsetstyle
}
214 \func{void
}{SetStyle
}{\param{int
}{ style
}}
218 \wxheading{Parameters
}
220 \docparam{style
}{One of
{\bf wxNORMAL
},
{\bf wxSLANT
} and
{\bf wxITALIC
}.
}
224 \helpref{wxFont::GetStyle
}{wxfontgetstyle
}
226 \membersection{wxFont::SetUnderlined
}\label{wxfontsetunderlined
}
228 \func{void
}{SetUnderlined
}{\param{const bool
}{ underlined
}}
232 \wxheading{Parameters
}
234 \docparam{underlining
}{TRUE to underline, FALSE otherwise.
}
238 \helpref{wxFont::GetUnderlined
}{wxfontgetunderlined
}
240 \membersection{wxFont::SetWeight
}\label{wxfontsetweight
}
242 \func{void
}{SetWeight
}{\param{int
}{ weight
}}
244 Sets the font weight.
246 \wxheading{Parameters
}
248 \docparam{weight
}{One of
{\bf wxNORMAL
},
{\bf wxLIGHT
} and
{\bf wxBOLD
}.
}
252 \helpref{wxFont::GetWeight
}{wxfontgetweight
}
254 \membersection{wxFont::operator $=$
}\label{wxfontassignment
}
256 \func{wxFont\&
}{operator $=$
}{\param{const wxFont\&
}{font
}}
258 Assignment operator, using reference counting. Returns a reference
261 \membersection{wxFont::operator $==$
}\label{wxfontequals
}
263 \func{bool
}{operator $==$
}{\param{const wxFont\&
}{font
}}
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
270 \membersection{wxFont::operator $!=$
}\label{wxfontnotequals
}
272 \func{bool
}{operator $!=$
}{\param{const wxFont\&
}{font
}}
274 Inequality operator. Two fonts are not equal if they contain pointers
275 to different underlying font data. It does not compare each attribute.