]>
git.saurik.com Git - wxWidgets.git/blob - docs/doxygen/overviews/font.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: topic overview
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
11 @page font_overview wxFont overview
13 Class: #wxFont, #wxFontDialog
14 A font is an object which determines the appearance of text, primarily
15 when drawing text to a window or device context. A font is determined by
16 the following parameters (not all of them have to be specified, of course):
28 This is the standard way of referring to text size.
39 Supported families are:
40 @b wxDEFAULT, wxDECORATIVE, wxROMAN, wxSCRIPT, wxSWISS, wxMODERN.
41 @b wxMODERN is a fixed pitch font; the others are either fixed or variable pitch.
52 The value can be @b wxNORMAL, wxSLANT or @b wxITALIC.
63 The value can be @b wxNORMAL, wxLIGHT or @b wxBOLD.
74 The value can be @true or @false.
85 An optional string specifying the actual typeface to be used. If @NULL,
86 a default typeface will chosen based on the family.
97 The font encoding (see @b wxFONTENCODING_XXX
98 constants and the @ref fontencoding_overview for more
105 Specifying a family, rather than a specific typeface name, ensures a degree of
106 portability across platforms because a suitable font will be chosen for the
107 given font family, however it doesn't allow to choose a font precisely as the
108 parameters above don't suffice, in general, to identify all the available fonts
109 and this is where using the native font descriptions may be helpful - see
111 Under Windows, the face name can be one of the installed fonts on the user's
112 system. Since the choice of fonts differs from system to system, either choose
113 standard Windows fonts, or if allowing the user to specify a face name, store
114 the family name with any file that might be transported to a different Windows
115 machine or other platform.
117 @b Note: There is currently a difference between the appearance
118 of fonts on the two platforms, if the mapping mode is anything other than
119 wxMM_TEXT. Under X, font size is always specified in points. Under MS
120 Windows, the unit for text is points but the text is scaled according to the
121 current mapping mode. However, user scaling on a device context will also
122 scale fonts under both environments.
124 @ref nativefontinformation_overview
127 @section nativefontinformation Native font information
129 An alternative way of choosing fonts is to use the native font description.
130 This is the only acceptable solution if the user is allowed to choose the font
131 using the #wxFontDialog because the selected font cannot
132 be described using only the family name and so, if only family name is stored
133 permanently, the user would almost surely see a different font in the program
135 Instead, you should store the value returned by
136 wxFont::GetNativeFontInfoDesc and pass
137 it to wxFont::SetNativeFontInfo later to
138 recreate exactly the same font.
139 Note that the contents of this string depends on the platform and shouldn't be
140 used for any other purpose (in particular, it is not meant to be shown to the
141 user). Also please note that although the native font information is currently
142 implemented for Windows and Unix (GTK+ and Motif) ports only, all the methods
143 are available for all the ports and should be used to make your program work
144 correctly when they are implemented later.