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
}
16 \wxheading{Predefined objects
}
31 \helpref{wxFont overview
}{wxfontoverview
},
\helpref{wxDC::SetFont
}{wxdcsetfont
},
\rtfsp
32 \helpref{wxDC::DrawText
}{wxdcdrawtext
},
\helpref{wxDC::GetTextExtent
}{wxdcgettextextent
},
\rtfsp
33 \helpref{wxFontDialog
}{wxfontdialog
}
35 \latexignore{\rtfignore{\wxheading{Members
}}}
37 \membersection{wxFont::wxFont
}\label{wxfontconstr
}
39 \func{}{wxFont
}{\void}
43 \func{}{wxFont
}{\param{int
}{ pointSize
},
\param{int
}{ family
},
\param{int
}{ style
},
\param{int
}{ weight
},
44 \param{const bool
}{ underline = FALSE
},
\param{const wxString\&
}{faceName = ""
}}
46 Creates a font object.
48 \wxheading{Parameters
}
50 \docparam{pointSize
}{Size in points.
}
52 \docparam{family
}{Font family, a generic way of referring to fonts without specifying actual facename. One of:
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.
}
64 \docparam{style
}{One of
{\bf wxNORMAL
},
{\bf wxSLANT
} and
{\bf wxITALIC
}.
}
66 \docparam{weight
}{One of
{\bf wxNORMAL
},
{\bf wxLIGHT
} and
{\bf wxBOLD
}.
}
68 \docparam{underline
}{The value can be TRUE or FALSE. At present this has an effect on Windows only.
}
70 \docparam{faceName
}{An optional string specifying the actual typeface to be used. If the empty string,
71 a default typeface will chosen based on the family.
}
75 If the desired font does not exist, the closest match will be chosen.
76 Under Windows, only scaleable TrueType fonts are used.
78 Underlining only works under Windows at present.
80 See also
\helpref{wxDC::SetFont
}{wxdcsetfont
},
\helpref{wxDC::DrawText
}{wxdcdrawtext
}
81 and
\helpref{wxDC::GetTextExtent
}{wxdcgettextextent
}.
83 \membersection{wxFont::
\destruct{wxFont
}}
85 \func{}{\destruct{wxFont
}}{\void}
91 The destructor may not delete the underlying font object of the native windowing
92 system, since wxBrush uses a reference counting system for efficiency.
94 Although all remaining fonts are deleted when the application exits,
95 the application should try to clean up all fonts itself. This is because
96 wxWindows cannot know if a pointer to the font object is stored in an
97 application data structure, and there is a risk of double deletion.
99 \membersection{wxFont::GetFaceName
}\label{wxfontgetfacename
}
101 \constfunc{wxString
}{GetFaceName
}{\void}
103 Returns the typeface name associated with the font, or the empty string if there is no
104 typeface information.
108 \helpref{wxFont::SetFaceName
}{wxfontsetfacename
}
110 \membersection{wxFont::GetFamily
}\label{wxfontgetfamily
}
112 \constfunc{int
}{GetFamily
}{\void}
114 Gets the font family. See
\helpref{wxFont::wxFont
}{wxfontconstr
} for a list of valid
119 \helpref{wxFont::SetFamily
}{wxfontsetfamily
}
121 \membersection{wxFont::GetFontId
}\label{wxfontgetfontid
}
123 \constfunc{int
}{GetFontId
}{\void}
125 Returns the font id, if the portable font system is in operation. See
\helpref{Font overview
}{wxfontoverview
} for
128 \membersection{wxFont::GetPointSize
}\label{wxfontgetpointsize
}
130 \constfunc{int
}{GetPointSize
}{\void}
136 \helpref{wxFont::SetPointSize
}{wxfontsetpointsize
}
138 \membersection{wxFont::GetStyle
}\label{wxfontgetstyle
}
140 \constfunc{int
}{GetStyle
}{\void}
142 Gets the font style. See
\helpref{wxFont::wxFont
}{wxfontconstr
} for a list of valid
147 \helpref{wxFont::SetStyle
}{wxfontsetstyle
}
149 \membersection{wxFont::GetUnderlined
}\label{wxfontgetunderlined
}
151 \constfunc{bool
}{GetUnderlined
}{\void}
153 Returns TRUE if the font is underlined, FALSE otherwise.
157 \helpref{wxFont::SetUnderlined
}{wxfontsetunderlined
}
159 \membersection{wxFont::GetWeight
}\label{wxfontgetweight
}
161 \constfunc{int
}{GetWeight
}{\void}
163 Gets the font weight. See
\helpref{wxFont::wxFont
}{wxfontconstr
} for a list of valid
168 \helpref{wxFont::SetWeight
}{wxfontsetweight
}
170 \membersection{wxFont::SetFaceName
}\label{wxfontsetfacename
}
172 \func{void
}{SetFaceName
}{\param{const wxString\&
}{faceName
}}
174 Sets the facename for the font.
176 \wxheading{Parameters
}
178 \docparam{faceName
}{A valid facename, which should be on the end-user's system.
}
182 To avoid portability problems, don't rely on a specific face, but specify the font family
183 instead or as well. A suitable font will be found on the end-user's system. If both the
184 family and the facename are specified, wxWindows will first search for the specific face,
185 and then for a font belonging to the same family.
189 \helpref{wxFont::GetFaceName
}{wxfontgetfacename
},
\helpref{wxFont::SetFamily
}{wxfontsetfamily
}
191 \membersection{wxFont::SetFamily
}\label{wxfontsetfamily
}
193 \func{void
}{SetFamily
}{\param{int
}{ family
}}
195 Sets the font family.
197 \wxheading{Parameters
}
199 \docparam{family
}{One of:
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.
}
213 \helpref{wxFont::GetFamily
}{wxfontgetfamily
},
\helpref{wxFont::SetFaceName
}{wxfontsetfacename
}
215 \membersection{wxFont::SetPointSize
}\label{wxfontsetpointsize
}
217 \func{void
}{SetPointSize
}{\param{int
}{ pointSize
}}
221 \wxheading{Parameters
}
223 \docparam{pointSize
}{Size in points.
}
227 \helpref{wxFont::GetPointSize
}{wxfontgetpointsize
}
229 \membersection{wxFont::SetStyle
}\label{wxfontsetstyle
}
231 \func{void
}{SetStyle
}{\param{int
}{ style
}}
235 \wxheading{Parameters
}
237 \docparam{style
}{One of
{\bf wxNORMAL
},
{\bf wxSLANT
} and
{\bf wxITALIC
}.
}
241 \helpref{wxFont::GetStyle
}{wxfontgetstyle
}
243 \membersection{wxFont::SetUnderlined
}\label{wxfontsetunderlined
}
245 \func{void
}{SetUnderlined
}{\param{const bool
}{ underlined
}}
249 \wxheading{Parameters
}
251 \docparam{underlining
}{TRUE to underline, FALSE otherwise.
}
255 \helpref{wxFont::GetUnderlined
}{wxfontgetunderlined
}
257 \membersection{wxFont::SetWeight
}\label{wxfontsetweight
}
259 \func{void
}{SetWeight
}{\param{int
}{ weight
}}
261 Sets the font weight.
263 \wxheading{Parameters
}
265 \docparam{weight
}{One of
{\bf wxNORMAL
},
{\bf wxLIGHT
} and
{\bf wxBOLD
}.
}
269 \helpref{wxFont::GetWeight
}{wxfontgetweight
}
271 \membersection{wxFont::operator $=$
}\label{wxfontassignment
}
273 \func{wxFont\&
}{operator $=$
}{\param{const wxFont\&
}{font
}}
275 Assignment operator, using reference counting. Returns a reference
278 \membersection{wxFont::operator $==$
}\label{wxfontequals
}
280 \func{bool
}{operator $==$
}{\param{const wxFont\&
}{font
}}
282 Equality operator. Two fonts are equal if they contain pointers
283 to the same underlying font data. It does not compare each attribute,
284 so two indefontdently-created fonts using the same parameters will
287 \membersection{wxFont::operator $!=$
}\label{wxfontnotequals
}
289 \func{bool
}{operator $!=$
}{\param{const wxFont\&
}{font
}}
291 Inequality operator. Two fonts are not equal if they contain pointers
292 to different underlying font data. It does not compare each attribute.