]> git.saurik.com Git - wxWidgets.git/blame - src/cocoa/fontutil.cpp
fixed variable shadowing icc warnings
[wxWidgets.git] / src / cocoa / fontutil.cpp
CommitLineData
a24aff65
DE
1/////////////////////////////////////////////////////////////////////////////
2// Name: unix/fontutil.cpp
3// Purpose: Font helper functions for X11 (GDK/X)
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 05.11.99
7// RCS-ID: $Id$
8// Copyright: (c) Vadim Zeitlin
65571936 9// Licence: wxWindows license
a24aff65
DE
10/////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
a24aff65
DE
20// For compilers that support precompilation, includes "wx.h".
21#include "wx/wxprec.h"
22
23#ifdef __BORLANDC__
24 #pragma hdrstop
25#endif
26
27#ifndef WX_PRECOMP
28#endif // PCH
29
30#include "wx/fontutil.h"
31#include "wx/fontmap.h"
32#include "wx/tokenzr.h"
33#include "wx/hash.h"
34#include "wx/module.h"
9c6e197f 35#include "wx/encinfo.h"
a24aff65
DE
36
37#ifdef __WXGTK20__
38
39#include "wx/gtk/private.h"
40
41// ----------------------------------------------------------------------------
42// wxNativeFontInfo
43// ----------------------------------------------------------------------------
44
45void wxNativeFontInfo::Init()
46{
47 description = NULL;
48}
49
50int wxNativeFontInfo::GetPointSize() const
51{
52 return pango_font_description_get_size( description ) / PANGO_SCALE;
53}
54
55wxFontStyle wxNativeFontInfo::GetStyle() const
56{
57 wxFontStyle m_style = wxFONTSTYLE_NORMAL;
58
59 switch (pango_font_description_get_style( description ))
60 {
61 case PANGO_STYLE_NORMAL:
62 m_style = wxFONTSTYLE_NORMAL;
63 break;
64 case PANGO_STYLE_ITALIC:
65 m_style = wxFONTSTYLE_ITALIC;
66 break;
67 case PANGO_STYLE_OBLIQUE:
68 m_style = wxFONTSTYLE_SLANT;
69 break;
70 }
71
72 return m_style;
73}
74
75wxFontWeight wxNativeFontInfo::GetWeight() const
76{
77 wxFontWeight m_weight = wxFONTWEIGHT_NORMAL;
78
79 switch (pango_font_description_get_weight( description ))
80 {
81 case PANGO_WEIGHT_ULTRALIGHT:
82 m_weight = wxFONTWEIGHT_LIGHT;
83 break;
84 case PANGO_WEIGHT_LIGHT:
85 m_weight = wxFONTWEIGHT_LIGHT;
86 break;
87 case PANGO_WEIGHT_NORMAL:
88 m_weight = wxFONTWEIGHT_NORMAL;
89 break;
90 case PANGO_WEIGHT_BOLD:
91 m_weight = wxFONTWEIGHT_BOLD;
92 break;
93 case PANGO_WEIGHT_ULTRABOLD:
94 m_weight = wxFONTWEIGHT_BOLD;
95 break;
96 case PANGO_WEIGHT_HEAVY:
97 m_weight = wxFONTWEIGHT_BOLD;
98 break;
99 }
100
101 return m_weight;
102}
103
104bool wxNativeFontInfo::GetUnderlined() const
105{
106 return FALSE;
107}
108
109wxString wxNativeFontInfo::GetFaceName() const
110{
111 wxString tmp = wxGTK_CONV_BACK( pango_font_description_get_family( description ) );
112
113 return tmp;
114}
115
116wxFontFamily wxNativeFontInfo::GetFamily() const
117{
118 return wxFONTFAMILY_SWISS;
119}
120
121wxFontEncoding wxNativeFontInfo::GetEncoding() const
122{
123 return wxFONTENCODING_SYSTEM;
124}
125
126// ----------------------------------------------------------------------------
127// wxNativeEncodingInfo
128// ----------------------------------------------------------------------------
129
130bool wxNativeEncodingInfo::FromString(const wxString& s)
131{
132 return FALSE;
133}
134
135wxString wxNativeEncodingInfo::ToString() const
136{
137 return wxEmptyString;
138}
139
140bool wxTestFontEncoding(const wxNativeEncodingInfo& info)
141{
142 return TRUE;
143}
144
145bool wxGetNativeFontEncoding(wxFontEncoding encoding,
146 wxNativeEncodingInfo *info)
147{
148 return FALSE;
149}
150
151#else
152 // __WXGTK20__
153
154#ifdef __X__
155 #ifdef __VMS__
156 #pragma message disable nosimpint
157 #endif
158
159 #include <X11/Xlib.h>
160
161 #ifdef __VMS__
162 #pragma message enable nosimpint
163 #endif
164
165 #include "wx/utils.h" // for wxGetDisplay()
166#elif defined(__WXGTK__)
167 // we have to declare struct tm to avoid problems with first forward
168 // declaring it in C code (glib.h included from gdk.h does it) and then
169 // defining it when time.h is included from the headers below - this is
170 // known not to work at least with Sun CC 6.01
171 #include <time.h>
172
173 #include <gdk/gdk.h>
174#endif
175
176
177// ----------------------------------------------------------------------------
178// private data
179// ----------------------------------------------------------------------------
180
181static wxHashTable *g_fontHash = (wxHashTable*) NULL;
182
183// ----------------------------------------------------------------------------
184// private functions
185// ----------------------------------------------------------------------------
186
187// ============================================================================
188// implementation
189// ============================================================================
190
191// ----------------------------------------------------------------------------
192// wxNativeEncodingInfo
193// ----------------------------------------------------------------------------
194
195// convert to/from the string representation: format is
196// encodingid;registry;encoding[;facename]
197bool wxNativeEncodingInfo::FromString(const wxString& s)
198{
199return false;
200}
201
202wxString wxNativeEncodingInfo::ToString() const
203{
204return wxEmptyString;
205}
206
207// ----------------------------------------------------------------------------
208// common functions
209// ----------------------------------------------------------------------------
210
211bool wxGetNativeFontEncoding(wxFontEncoding encoding,
212 wxNativeEncodingInfo *info)
213{
214 return FALSE;
215}
216
217bool wxTestFontEncoding(const wxNativeEncodingInfo& info)
218{
219return false;
220}
221
222// ----------------------------------------------------------------------------
223// private functions
224// ----------------------------------------------------------------------------
225
226// ----------------------------------------------------------------------------
227// wxFontModule
228// ----------------------------------------------------------------------------
229
230class wxFontModule : public wxModule
231{
232public:
233 bool OnInit();
234 void OnExit();
235
236private:
237 DECLARE_DYNAMIC_CLASS(wxFontModule)
238};
239
240IMPLEMENT_DYNAMIC_CLASS(wxFontModule, wxModule)
241
242bool wxFontModule::OnInit()
243{
244 g_fontHash = new wxHashTable( wxKEY_STRING );
245
246 return TRUE;
247}
248
249void wxFontModule::OnExit()
250{
251 delete g_fontHash;
252
253 g_fontHash = (wxHashTable *)NULL;
254}
255
256#endif
257 // not GTK 2.0