]>
Commit | Line | Data |
---|---|---|
15b6757b | 1 | ///////////////////////////////////////////////////////////////////////////// |
3b88355f | 2 | // Name: font.h |
15b6757b FM |
3 | // Purpose: topic overview |
4 | // Author: wxWidgets team | |
526954c5 | 5 | // Licence: wxWindows licence |
15b6757b FM |
6 | ///////////////////////////////////////////////////////////////////////////// |
7 | ||
880efa2a | 8 | /** |
36c9828f | 9 | |
928f1a07 FM |
10 | @page overview_font wxFont Overview |
11 | ||
831e1028 | 12 | @tableofcontents |
928f1a07 | 13 | |
831e1028 BP |
14 | A font is an object which determines the appearance of text, primarily when |
15 | drawing text to a window or device context. A font is determined by the | |
16 | following parameters (not all of them have to be specified, of course): | |
928f1a07 FM |
17 | |
18 | @beginDefList | |
19 | @itemdef{Point size, This is the standard way of referring to text size.} | |
20 | @itemdef{Family, | |
21 | Supported families are: | |
22 | @b wxDEFAULT, @b wxDECORATIVE, @b wxROMAN, @b wxSCRIPT, @b wxSWISS, @b wxMODERN. | |
23 | @b wxMODERN is a fixed pitch font; the others are either fixed or variable pitch.} | |
24 | @itemdef{Style, The value can be @b wxNORMAL, @b wxSLANT or @b wxITALIC.} | |
25 | @itemdef{Weight, The value can be @b wxNORMAL, @b wxLIGHT or @b wxBOLD.} | |
26 | @itemdef{Underlining, The value can be @true or @false.} | |
27 | @itemdef{Face name, | |
28 | An optional string specifying the actual typeface to be used. If @NULL, | |
29 | a default typeface will chosen based on the family.} | |
30 | @itemdef{Encoding, | |
31 | The font encoding (see @b wxFONTENCODING_XXX | |
32 | constants and the @ref overview_fontencoding for more details)} | |
33 | @endDefList | |
34 | ||
35 | Specifying a family, rather than a specific typeface name, ensures a degree of | |
36 | portability across platforms because a suitable font will be chosen for the | |
37 | given font family, however it doesn't allow to choose a font precisely as the | |
38 | parameters above don't suffice, in general, to identify all the available fonts | |
39 | and this is where using the native font descriptions may be helpful - see | |
40 | below. | |
41 | ||
42 | Under Windows, the face name can be one of the installed fonts on the user's | |
43 | system. Since the choice of fonts differs from system to system, either choose | |
44 | standard Windows fonts, or if allowing the user to specify a face name, store | |
45 | the family name with any file that might be transported to a different Windows | |
46 | machine or other platform. | |
47 | ||
831e1028 BP |
48 | @see wxFont, wxFontDialog |
49 | ||
50 | @note There is currently a difference between the appearance of fonts on the | |
51 | two platforms, if the mapping mode is anything other than wxMM_TEXT. | |
52 | Under X, font size is always specified in points. Under MS Windows, the | |
53 | unit for text is points but the text is scaled according to the current | |
54 | mapping mode. However, user scaling on a device context will also scale | |
55 | fonts under both environments. | |
928f1a07 FM |
56 | |
57 | ||
58 | ||
831e1028 | 59 | @section overview_font_nativeinfo Native Font Information |
928f1a07 FM |
60 | |
61 | An alternative way of choosing fonts is to use the native font description. | |
62 | This is the only acceptable solution if the user is allowed to choose the font | |
63 | using the wxFontDialog because the selected font cannot | |
64 | be described using only the family name and so, if only family name is stored | |
65 | permanently, the user would almost surely see a different font in the program | |
66 | later. | |
67 | ||
68 | Instead, you should store the value returned by wxFont::GetNativeFontInfoDesc and pass | |
69 | it to wxFont::SetNativeFontInfo later to recreate exactly the same font. | |
70 | ||
71 | Note that the contents of this string depends on the platform and shouldn't be | |
72 | used for any other purpose (in particular, it is not meant to be shown to the | |
73 | user). Also please note that although the native font information is currently | |
74 | implemented for Windows and Unix (GTK+ and Motif) ports only, all the methods | |
75 | are available for all the ports and should be used to make your program work | |
76 | correctly when they are implemented later. | |
36c9828f | 77 | |
3b88355f | 78 | */ |