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