wxNativeFontInfo changes
[wxWidgets.git] / include / wx / fontutil.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/fontutil.h
3 // Purpose: font-related helper functions
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 05.11.99
7 // RCS-ID: $Id$
8 // Copyright: (c) wxWindows team
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 // General note: this header is private to wxWindows and is not supposed to be
13 // included by user code. The functions declared here are implemented in
14 // msw/fontutil.cpp for Windows, unix/fontutil.cpp for GTK/Motif &c.
15
16 #ifndef _WX_FONTUTIL_H_
17 #define _WX_FONTUTIL_H_
18
19 #ifdef __GNUG__
20 #pragma interface "fontutil.h"
21 #endif
22
23 // ----------------------------------------------------------------------------
24 // headers
25 // ----------------------------------------------------------------------------
26
27 #include "wx/font.h" // for wxFont and wxFontEncoding
28
29 // ----------------------------------------------------------------------------
30 // types
31 // ----------------------------------------------------------------------------
32
33 // wxNativeFontInfo is platform-specific font representation: this struct
34 // should be considered as opaque font description only used by the native
35 // functions, the user code can only get the objects of this type from
36 // somewhere and pass it somewhere else (possibly save them somewhere using
37 // ToString() and restore them using FromString())
38 struct WXDLLEXPORT wxNativeFontInfo
39 {
40 #if defined(__WXGTK__)
41 wxString xFontName;
42 #else // other platforms
43 //
44 // This is a generic implementation that should work on all ports
45 // without specific support by the port.
46 //
47 int pointSize;
48 int family;
49 int style;
50 int weight;
51 bool underlined;
52 wxString faceName;
53 wxFontEncoding encoding;
54 #endif // platforms
55
56 // it is important to be able to serialize wxNativeFontInfo objects to be
57 // able to store them (in config file, for example)
58 bool FromString(const wxString& s);
59 wxString ToString() const;
60 };
61
62 // ----------------------------------------------------------------------------
63 // font-related functions (common)
64 // ----------------------------------------------------------------------------
65
66 // translate a wxFontEncoding into native encoding parameter (defined above),
67 // returning TRUE if an (exact) macth could be found, FALSE otherwise (without
68 // attempting any substitutions)
69 extern bool wxGetNativeFontEncoding(wxFontEncoding encoding,
70 wxNativeEncodingInfo *info);
71
72 // test for the existence of the font described by this facename/encoding,
73 // return TRUE if such font(s) exist, FALSE otherwise
74 extern bool wxTestFontEncoding(const wxNativeEncodingInfo& info);
75
76 // ----------------------------------------------------------------------------
77 // font-related functions (X and GTK)
78 // ----------------------------------------------------------------------------
79
80 #ifdef _WX_X_FONTLIKE
81 #include "wx/unix/fontutil.h"
82 #endif // X || GDK
83
84 #endif // _WX_FONTUTIL_H_