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