]> git.saurik.com Git - wxWidgets.git/blob - include/wx/fontutil.h
last line missing
[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 // for our purposes here, GDK and X are identical
30 #if defined(__WXGTK__) || defined(__X__)
31 #define _WX_X_FONTLIKE
32 #endif
33
34 // ----------------------------------------------------------------------------
35 // types
36 // ----------------------------------------------------------------------------
37
38 // This private structure specifies all the parameters needed to create a font
39 // with the given encoding on this platform.
40 //
41 // Under X, it contains the last 2 elements of the font specifications
42 // (registry and encoding).
43 //
44 // Under Windows, it contains a number which is one of predefined CHARSET_XXX
45 // values.
46 //
47 // Under all platforms it also contains a facename string which should be
48 // used, if not empty, to create fonts in this encoding (this is the only way
49 // to create a font of non-standard encoding (like KOI8) under Windows - the
50 // facename specifies the encoding then)
51
52 struct WXDLLEXPORT wxNativeEncodingInfo
53 {
54 wxString facename; // may be empty meaning "any"
55 wxFontEncoding encoding; // so that we know what this struct represents
56
57 #if defined(__WXMSW__) || defined(__WXPM__) || defined(__WXMAC__)
58 wxNativeEncodingInfo() { charset = 0; /* ANSI_CHARSET */ }
59
60 int charset;
61 #elif defined(_WX_X_FONTLIKE)
62 wxString xregistry,
63 xencoding;
64 #else
65 #error "Unsupported toolkit"
66 #endif
67
68 // this struct is saved in config by wxFontMapper, so it should know to
69 // serialise itself (implemented in platform-specific code)
70 bool FromString(const wxString& s);
71 wxString ToString() const;
72 };
73
74 // ----------------------------------------------------------------------------
75 // font-related functions (common)
76 // ----------------------------------------------------------------------------
77
78 // translate a wxFontEncoding into native encoding parameter (defined above),
79 // returning TRUE if an (exact) macth could be found, FALSE otherwise (without
80 // attempting any substitutions)
81 extern bool wxGetNativeFontEncoding(wxFontEncoding encoding,
82 wxNativeEncodingInfo *info);
83
84 // test for the existence of the font described by this facename/encoding,
85 // return TRUE if such font(s) exist, FALSE otherwise
86 extern bool wxTestFontEncoding(const wxNativeEncodingInfo& info);
87
88 // ----------------------------------------------------------------------------
89 // font-related functions (X and GTK)
90 // ----------------------------------------------------------------------------
91
92 #ifdef _WX_X_FONTLIKE
93 #include "wx/unix/fontutil.h"
94 #endif // X || GDK
95
96 #endif // _WX_FONTUTIL_H_