1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: font-related helper functions
4 // Author: Vadim Zeitlin
8 // Copyright: (c) wxWindows team
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
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.
16 #ifndef _WX_FONTUTIL_H_
17 #define _WX_FONTUTIL_H_
20 #pragma interface "fontutil.h"
23 // ----------------------------------------------------------------------------
25 // ----------------------------------------------------------------------------
27 #include "wx/font.h" // for wxFont and wxFontEncoding
29 // for our purposes here, GDK and X are identical
30 #if defined(__WXGTK__) || defined(__X__)
31 #define _WX_X_FONTLIKE
34 // ----------------------------------------------------------------------------
36 // ----------------------------------------------------------------------------
38 // This private structure specifies all the parameters needed to create a font
39 // with the given encoding on this platform.
41 // Under X, it contains the last 2 elements of the font specifications
42 // (registry and encoding).
44 // Under Windows, it contains a number which is one of predefined CHARSET_XXX
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)
52 struct WXDLLEXPORT wxNativeEncodingInfo
54 wxString facename
; // may be empty meaning "any"
55 wxFontEncoding encoding
; // so that we know what this struct represents
57 #if defined(__WXMSW__) || defined(__WXPM__) || defined(__WXMAC__)
58 wxNativeEncodingInfo() { charset
= 0; /* ANSI_CHARSET */ }
61 #elif defined(_WX_X_FONTLIKE)
65 #error "Unsupported toolkit"
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;
74 // ----------------------------------------------------------------------------
75 // font-related functions (common)
76 // ----------------------------------------------------------------------------
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
);
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
);
88 // ----------------------------------------------------------------------------
89 // font-related functions (X and GTK)
90 // ----------------------------------------------------------------------------
93 #include "wx/unix/fontutil.h"
96 #endif // _WX_FONTUTIL_H_