]> git.saurik.com Git - wxWidgets.git/blob - include/wx/fontutil.h
1. wxFontMapper almost finished
[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 wxNativeEncodingInfo
53 {
54 wxString facename; // may be empty meaning "any"
55
56 #if defined(__WXMSW__)
57 int charset;
58 #elif defined(_WX_X_FONTLIKE)
59 wxString xregistry,
60 xencoding;
61 #else
62 #error "Unsupported toolkit"
63 #endif
64
65 // this struct is saved in config by wxFontMapper, so it should know to
66 // serialise itself (implemented in platform-specific code)
67 bool FromString(const wxString& s);
68 wxString ToString() const;
69 };
70
71 // ----------------------------------------------------------------------------
72 // font-related functions (common)
73 // ----------------------------------------------------------------------------
74
75 // translate a wxFontEncoding into native encoding parameter (defined above),
76 // returning TRUE if an (exact) macth could be found, FALSE otherwise (without
77 // attempting any substitutions)
78 extern bool wxGetNativeFontEncoding(wxFontEncoding encoding,
79 wxNativeEncodingInfo *info);
80
81 // test for the existence of the font described by this facename/encoding,
82 // return TRUE if such font(s) exist, FALSE otherwise
83 extern bool wxTestFontEncoding(const wxNativeEncodingInfo& info);
84
85 // ----------------------------------------------------------------------------
86 // font-related functions (X and GTK)
87 // ----------------------------------------------------------------------------
88
89 #ifdef _WX_X_FONTLIKE
90 #include "wx/unix/fontutil.h"
91 #endif // X || GDK
92
93 #endif // _WX_FONTUTIL_H_