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
}
12 \wxheading{Include files
}
18 \helpref{wxFont overview
}{wxfontoverview
},
\helpref{wxDC::SetFont
}{wxdcsetfont
},
\rtfsp
19 \helpref{wxDC::DrawText
}{wxdcdrawtext
},
\helpref{wxDC::GetTextExtent
}{wxdcgettextextent
},
\rtfsp
20 \helpref{wxFontDialog
}{wxfontdialog
}
22 \latexignore{\rtfignore{\wxheading{Members
}}}
24 \membersection{wxFont::wxFont
}\label{wxfontconstr
}
26 \func{}{wxFont
}{\void}
30 \func{}{wxFont
}{\param{int
}{ pointSize
},
\param{int
}{ family
},
\param{int
}{ style
},
\param{int
}{ weight
},
31 \param{const bool
}{ underline = FALSE
},
\param{const wxString\&
}{faceName = ""
}}
33 Creates a font object.
35 \wxheading{Parameters
}
37 \docparam{pointSize
}{Size in points.
}
39 \docparam{family
}{Font family, a generic way of referring to fonts without specifying actual facename. One of:
42 \begin{twocollist
}\itemsep=
0pt
43 \twocolitem{{\bf wxDEFAULT
}}{Chooses a default font.
}
44 \twocolitem{{\bf wxDECORATIVE
}}{A decorative font.
}
45 \twocolitem{{\bf wxROMAN
}}{A formal, serif font.
}
46 \twocolitem{{\bf wxSCRIPT
}}{A handwriting font.
}
47 \twocolitem{{\bf wxSWISS
}}{A sans-serif font.
}
48 \twocolitem{{\bf wxMODERN
}}{A fixed pitch font.
}
51 \docparam{style
}{One of
{\bf wxNORMAL
},
{\bf wxSLANT
} and
{\bf wxITALIC
}.
}
53 \docparam{weight
}{One of
{\bf wxNORMAL
},
{\bf wxLIGHT
} and
{\bf wxBOLD
}.
}
55 \docparam{underline
}{The value can be TRUE or FALSE. At present this has an effect on Windows only.
}
57 \docparam{faceName
}{An optional string specifying the actual typeface to be used. If the empty string,
58 a default typeface will chosen based on the family.
}
62 If the desired font does not exist, the closest match will be chosen.
63 Under Windows, only scaleable TrueType fonts are used.
65 Underlining only works under Windows at present.
67 See also
\helpref{wxDC::SetFont
}{wxdcsetfont
},
\helpref{wxDC::DrawText
}{wxdcdrawtext
}
68 and
\helpref{wxDC::GetTextExtent
}{wxdcgettextextent
}.
70 \membersection{wxFont::
\destruct{wxFont
}}
72 \func{}{\destruct{wxFont
}}{\void}
78 The destructor may not delete the underlying font object of the native windowing
79 system, since wxBrush uses a reference counting system for efficiency.
81 Although all remaining fonts are deleted when the application exits,
82 the application should try to clean up all fonts itself. This is because
83 wxWindows cannot know if a pointer to the font object is stored in an
84 application data structure, and there is a risk of double deletion.
86 \membersection{wxFont::GetFaceName
}\label{wxfontgetfacename
}
88 \constfunc{wxString
}{GetFaceName
}{\void}
90 Returns the typeface name associated with the font, or the empty string if there is no
95 \helpref{wxFont::SetFaceName
}{wxfontsetfacename
}
97 \membersection{wxFont::GetFamily
}\label{wxfontgetfamily
}
99 \constfunc{int
}{GetFamily
}{\void}
101 Gets the font family. See
\helpref{wxFont::wxFont
}{wxfontconstr
} for a list of valid
106 \helpref{wxFont::SetFamily
}{wxfontsetfamily
}
108 \membersection{wxFont::GetFontId
}\label{wxfontgetfontid
}
110 \constfunc{int
}{GetFontId
}{\void}
112 Returns the font id, if the portable font system is in operation. See
\helpref{Font overview
}{wxfontoverview
} for
115 \membersection{wxFont::GetPointSize
}\label{wxfontgetpointsize
}
117 \constfunc{int
}{GetPointSize
}{\void}
123 \helpref{wxFont::SetPointSize
}{wxfontsetpointsize
}
125 \membersection{wxFont::GetStyle
}\label{wxfontgetstyle
}
127 \constfunc{int
}{GetStyle
}{\void}
129 Gets the font style. See
\helpref{wxFont::wxFont
}{wxfontconstr
} for a list of valid
134 \helpref{wxFont::SetStyle
}{wxfontsetstyle
}
136 \membersection{wxFont::GetUnderlined
}\label{wxfontgetunderlined
}
138 \constfunc{bool
}{GetUnderlined
}{\void}
140 Returns TRUE if the font is underlined, FALSE otherwise.
144 \helpref{wxFont::SetUnderlined
}{wxfontsetunderlined
}
146 \membersection{wxFont::GetWeight
}\label{wxfontgetweight
}
148 \constfunc{int
}{GetWeight
}{\void}
150 Gets the font weight. See
\helpref{wxFont::wxFont
}{wxfontconstr
} for a list of valid
155 \helpref{wxFont::SetWeight
}{wxfontsetweight
}
157 \membersection{wxFont::SetFaceName
}\label{wxfontsetfacename
}
159 \func{void
}{SetFaceName
}{\param{const wxString\&
}{faceName
}}
161 Sets the facename for the font.
163 \wxheading{Parameters
}
165 \docparam{faceName
}{A valid facename, which should be on the end-user's system.
}
169 To avoid portability problems, don't rely on a specific face, but specify the font family
170 instead or as well. A suitable font will be found on the end-user's system. If both the
171 family and the facename are specified, wxWindows will first search for the specific face,
172 and then for a font belonging to the same family.
176 \helpref{wxFont::GetFaceName
}{wxfontgetfacename
},
\helpref{wxFont::SetFamily
}{wxfontsetfamily
}
178 \membersection{wxFont::SetFamily
}\label{wxfontsetfamily
}
180 \func{void
}{SetFamily
}{\param{int
}{ family
}}
182 Sets the font family.
184 \wxheading{Parameters
}
186 \docparam{family
}{One of:
189 \begin{twocollist
}\itemsep=
0pt
190 \twocolitem{{\bf wxDEFAULT
}}{Chooses a default font.
}
191 \twocolitem{{\bf wxDECORATIVE
}}{A decorative font.
}
192 \twocolitem{{\bf wxROMAN
}}{A formal, serif font.
}
193 \twocolitem{{\bf wxSCRIPT
}}{A handwriting font.
}
194 \twocolitem{{\bf wxSWISS
}}{A sans-serif font.
}
195 \twocolitem{{\bf wxMODERN
}}{A fixed pitch font.
}
200 \helpref{wxFont::GetFamily
}{wxfontgetfamily
},
\helpref{wxFont::SetFaceName
}{wxfontsetfacename
}
202 \membersection{wxFont::SetPointSize
}\label{wxfontsetpointsize
}
204 \func{void
}{SetPointSize
}{\param{int
}{ pointSize
}}
208 \wxheading{Parameters
}
210 \docparam{pointSize
}{Size in points.
}
214 \helpref{wxFont::GetPointSize
}{wxfontgetpointsize
}
216 \membersection{wxFont::SetStyle
}\label{wxfontsetstyle
}
218 \func{void
}{SetStyle
}{\param{int
}{ style
}}
222 \wxheading{Parameters
}
224 \docparam{style
}{One of
{\bf wxNORMAL
},
{\bf wxSLANT
} and
{\bf wxITALIC
}.
}
228 \helpref{wxFont::GetStyle
}{wxfontgetstyle
}
230 \membersection{wxFont::SetUnderlined
}\label{wxfontsetunderlined
}
232 \func{void
}{SetUnderlined
}{\param{const bool
}{ underlined
}}
236 \wxheading{Parameters
}
238 \docparam{underlining
}{TRUE to underline, FALSE otherwise.
}
242 \helpref{wxFont::GetUnderlined
}{wxfontgetunderlined
}
244 \membersection{wxFont::SetWeight
}\label{wxfontsetweight
}
246 \func{void
}{SetWeight
}{\param{int
}{ weight
}}
248 Sets the font weight.
250 \wxheading{Parameters
}
252 \docparam{weight
}{One of
{\bf wxNORMAL
},
{\bf wxLIGHT
} and
{\bf wxBOLD
}.
}
256 \helpref{wxFont::GetWeight
}{wxfontgetweight
}
258 \membersection{wxFont::operator $=$
}\label{wxfontassignment
}
260 \func{wxFont\&
}{operator $=$
}{\param{const wxFont\&
}{font
}}
262 Assignment operator, using reference counting. Returns a reference
265 \membersection{wxFont::operator $==$
}\label{wxfontequals
}
267 \func{bool
}{operator $==$
}{\param{const wxFont\&
}{font
}}
269 Equality operator. Two fonts are equal if they contain pointers
270 to the same underlying font data. It does not compare each attribute,
271 so two indefontdently-created fonts using the same parameters will
274 \membersection{wxFont::operator $!=$
}\label{wxfontnotequals
}
276 \func{bool
}{operator $!=$
}{\param{const wxFont\&
}{font
}}
278 Inequality operator. Two fonts are not equal if they contain pointers
279 to different underlying font data. It does not compare each attribute.