]>
Commit | Line | Data |
---|---|---|
7beba2fc VZ |
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 | ||
09fcd889 VZ |
29 | #if defined(__WXMSW__) |
30 | #include <windows.h> | |
31 | #include "wx/msw/winundef.h" | |
32 | #endif | |
33 | ||
7beba2fc VZ |
34 | // ---------------------------------------------------------------------------- |
35 | // types | |
36 | // ---------------------------------------------------------------------------- | |
37 | ||
7826e2dd VZ |
38 | // wxNativeFontInfo is platform-specific font representation: this struct |
39 | // should be considered as opaque font description only used by the native | |
40 | // functions, the user code can only get the objects of this type from | |
41 | // somewhere and pass it somewhere else (possibly save them somewhere using | |
42 | // ToString() and restore them using FromString()) | |
43 | struct WXDLLEXPORT wxNativeFontInfo | |
7beba2fc | 44 | { |
7826e2dd VZ |
45 | #if defined(__WXGTK__) |
46 | wxString xFontName; | |
09fcd889 VZ |
47 | #elif defined(__WXMSW__) |
48 | LOGFONT lf; | |
7826e2dd VZ |
49 | #else // other platforms |
50 | // | |
51 | // This is a generic implementation that should work on all ports | |
52 | // without specific support by the port. | |
53 | // | |
54 | int pointSize; | |
55 | int family; | |
56 | int style; | |
57 | int weight; | |
58 | bool underlined; | |
59 | wxString faceName; | |
60 | wxFontEncoding encoding; | |
61 | #endif // platforms | |
62 | ||
63 | // it is important to be able to serialize wxNativeFontInfo objects to be | |
64 | // able to store them (in config file, for example) | |
7beba2fc VZ |
65 | bool FromString(const wxString& s); |
66 | wxString ToString() const; | |
67 | }; | |
68 | ||
69 | // ---------------------------------------------------------------------------- | |
70 | // font-related functions (common) | |
71 | // ---------------------------------------------------------------------------- | |
72 | ||
73 | // translate a wxFontEncoding into native encoding parameter (defined above), | |
74 | // returning TRUE if an (exact) macth could be found, FALSE otherwise (without | |
75 | // attempting any substitutions) | |
76 | extern bool wxGetNativeFontEncoding(wxFontEncoding encoding, | |
77 | wxNativeEncodingInfo *info); | |
78 | ||
79 | // test for the existence of the font described by this facename/encoding, | |
80 | // return TRUE if such font(s) exist, FALSE otherwise | |
81 | extern bool wxTestFontEncoding(const wxNativeEncodingInfo& info); | |
82 | ||
83 | // ---------------------------------------------------------------------------- | |
84 | // font-related functions (X and GTK) | |
85 | // ---------------------------------------------------------------------------- | |
86 | ||
87 | #ifdef _WX_X_FONTLIKE | |
88 | #include "wx/unix/fontutil.h" | |
89 | #endif // X || GDK | |
90 | ||
91 | #endif // _WX_FONTUTIL_H_ |