]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/tfont.tex
another patch bring the docs more up to date (patch 1717776)
[wxWidgets.git] / docs / latex / wx / tfont.tex
CommitLineData
ccaaf5b0 1\section{wxFont overview}\label{wxfontoverview}
a660d684 2
dccb75b6 3Class: \helpref{wxFont}{wxfont}, \helpref{wxFontDialog}{wxfontdialog}
a660d684
KB
4
5A font is an object which determines the appearance of text, primarily
fe604ccd 6when drawing text to a window or device context. A font is determined by
775a998e 7the following parameters (not all of them have to be specified, of course):
a660d684
KB
8
9\begin{twocollist}\itemsep=0pt
10\twocolitem{Point size}{This is the standard way of referring to text size.}
11\twocolitem{Family}{Supported families are:
cd77c085
JS
12 {\bf wxDEFAULT, wxDECORATIVE, wxROMAN, wxSCRIPT, wxSWISS, wxMODERN}.
13 {\bf wxMODERN} is a fixed pitch font; the others are either fixed or variable pitch.}
a660d684
KB
14\twocolitem{Style}{The value can be {\bf wxNORMAL, wxSLANT} or {\bf wxITALIC}.}
15\twocolitem{Weight}{The value can be {\bf wxNORMAL, wxLIGHT} or {\bf wxBOLD}.}
cc81d32f 16\twocolitem{Underlining}{The value can be true or false.}
a660d684
KB
17\twocolitem{Face name}{An optional string specifying the actual typeface to be used. If NULL,
18a default typeface will chosen based on the family.}
775a998e
VZ
19\twocolitem{Encoding}{The font encoding (see {\bf wxFONTENCODING\_XXX}
20constants and the \helpref{font overview}{wxfontencodingoverview} for more
21details)}
a660d684
KB
22\end{twocollist}
23
775a998e
VZ
24Specifying a family, rather than a specific typeface name, ensures a degree of
25portability across platforms because a suitable font will be chosen for the
dccb75b6
VZ
26given font family, however it doesn't allow to choose a font precisely as the
27parameters above don't suffice, in general, to identify all the available fonts
28and this is where using the native font descriptions may be helpful - see
29below.
775a998e
VZ
30
31Under Windows, the face name can be one of the installed fonts on the user's
32system. Since the choice of fonts differs from system to system, either choose
33standard Windows fonts, or if allowing the user to specify a face name, store
dccb75b6 34the family name with any file that might be transported to a different Windows
775a998e
VZ
35machine or other platform.
36
37\normalbox{{\bf Note:} There is currently a difference between the appearance
38of fonts on the two platforms, if the mapping mode is anything other than
39wxMM\_TEXT. Under X, font size is always specified in points. Under MS
40Windows, the unit for text is points but the text is scaled according to the
41current mapping mode. However, user scaling on a device context will also
42scale fonts under both environments.}
a660d684 43
6d06e061 44\subsection{Native font information}\label{nativefontinformation}
dccb75b6
VZ
45
46An alternative way of choosing fonts is to use the native font description.
47This is the only acceptable solution if the user is allowed to choose the font
48using the \helpref{wxFontDialog}{wxfontdialog} because the selected font cannot
49be described using only the family name and so, if only family name is stored
50permanently, the user would almost surely see a different font in the program
51later.
52
53Instead, you should store the value returned by
54\helpref{wxFont::GetNativeFontInfoDesc}{wxfontgetnativefontinfodesc} and pass
55it to \helpref{wxFont::SetNativeFontInfo}{wxfontsetnativefontinfo} later to
56recreate exactly the same font.
57
58Note that the contents of this string depends on the platform and shouldn't be
59used for any other purpose (in particular, it is not meant to be shown to the
60user). Also please note that although the native font information is currently
61implemented for Windows and Unix (GTK+ and Motif) ports only, all the methods
62are available for all the ports and should be used to make your program work
63correctly when they are implemented later.
64