]> git.saurik.com Git - wxWidgets.git/blame - src/mgl/fontenum.cpp
Add default constructor to wxGraphicsGradientStop.
[wxWidgets.git] / src / mgl / fontenum.cpp
CommitLineData
32b8ec41 1/////////////////////////////////////////////////////////////////////////////
7520f3da 2// Name: src/mgl/fontenum.cpp
32b8ec41
VZ
3// Purpose: wxFontEnumerator class for MGL
4// Author: Vaclav Slavik
5// RCS-ID: $Id$
c41c20a5 6// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
65571936 7// Licence: wxWindows licence
32b8ec41
VZ
8/////////////////////////////////////////////////////////////////////////////
9
7520f3da
WS
10// For compilers that support precompilation, includes "wx.h".
11#include "wx/wxprec.h"
12
13#ifdef __BORLANDC__
14 #pragma hdrstop
15#endif
16
32b8ec41
VZ
17// ============================================================================
18// declarations
19// ============================================================================
20
21// ----------------------------------------------------------------------------
22// headers
23// ----------------------------------------------------------------------------
24
df91131c
WS
25#include "wx/fontenum.h"
26
ad9835c9
WS
27#ifndef WX_PRECOMP
28 #include "wx/dynarray.h"
df91131c 29 #include "wx/string.h"
de6185e2 30 #include "wx/utils.h"
ad9835c9
WS
31#endif
32
3af1a9f8 33#include "wx/encinfo.h"
32b8ec41 34#include "wx/fontutil.h"
d7ae4a62 35#include "wx/private/fontmgr.h"
32b8ec41
VZ
36
37#include <mgraph.h>
38
39// ============================================================================
40// implementation
41// ============================================================================
42
43
44// ----------------------------------------------------------------------------
45// wxFontEnumerator
46// ----------------------------------------------------------------------------
47
48bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
49 bool fixedWidthOnly)
50{
7520f3da 51 bool found = false;
d7ae4a62
VS
52 const wxFontBundleList& list = wxFontsManager::Get()->GetBundles();
53 wxFontBundleList::Node *node;
54 wxFontBundle *f = NULL;
32b8ec41
VZ
55 wxNativeEncodingInfo info;
56
57 if ( encoding != wxFONTENCODING_SYSTEM )
58 wxGetNativeFontEncoding(encoding, &info);
7520f3da 59
d7ae4a62 60 for (node = list.GetFirst(); node; node = node->GetNext())
32b8ec41
VZ
61 {
62 f = node->GetData();
63 info.facename = f->GetName();
d7ae4a62 64 if ( (!fixedWidthOnly || f->IsFixed()) &&
32b8ec41
VZ
65 (encoding == wxFONTENCODING_SYSTEM || wxTestFontEncoding(info)) )
66 {
7520f3da 67 found = true;
32b8ec41 68 if ( !OnFacename(f->GetName()) )
7520f3da 69 return true;
32b8ec41
VZ
70 }
71 }
72
73 return found;
74}
75
76bool wxFontEnumerator::EnumerateEncodings(const wxString& family)
77{
7520f3da 78 static wxFontEncoding encodings[] =
32b8ec41
VZ
79 {
80 wxFONTENCODING_ISO8859_1,
81 wxFONTENCODING_ISO8859_2,
82 wxFONTENCODING_ISO8859_3,
83 wxFONTENCODING_ISO8859_4,
84 wxFONTENCODING_ISO8859_5,
85 wxFONTENCODING_ISO8859_6,
86 wxFONTENCODING_ISO8859_7,
87 wxFONTENCODING_ISO8859_8,
88 wxFONTENCODING_ISO8859_9,
89 wxFONTENCODING_ISO8859_10,
90 //wxFONTENCODING_ISO8859_11,
91 //wxFONTENCODING_ISO8859_12,
92 wxFONTENCODING_ISO8859_13,
93 wxFONTENCODING_ISO8859_14,
94 wxFONTENCODING_ISO8859_15,
95 wxFONTENCODING_CP1250,
96 wxFONTENCODING_CP1251,
97 wxFONTENCODING_CP1252,
98 wxFONTENCODING_CP1253,
99 wxFONTENCODING_CP1254,
100 wxFONTENCODING_CP1255,
101 wxFONTENCODING_CP1256,
102 wxFONTENCODING_CP1257,
103 wxFONTENCODING_KOI8,
7520f3da 104
32b8ec41
VZ
105 wxFONTENCODING_SYSTEM
106 };
7520f3da
WS
107
108 static const char *encodingNames[] =
32b8ec41
VZ
109 {
110 "iso88590-1",
111 "iso88590-2",
112 "iso88590-3",
113 "iso88590-4",
114 "iso88590-5",
115 "iso88590-6",
116 "iso88590-7",
117 "iso88590-8",
118 "iso88590-9",
119 "iso88590-10",
120 "iso88590-13",
121 "iso88590-14",
122 "iso88590-15",
123 "windows-1250",
124 "windows-1251",
125 "windows-1252",
126 "windows-1253",
127 "windows-1254",
128 "windows-1255",
129 "windows-1256",
130 "windows-1257",
131 "koi-8",
132 NULL
133 };
7520f3da 134
32b8ec41
VZ
135 wxNativeEncodingInfo info;
136 info.facename = family;
7520f3da 137
32b8ec41
VZ
138 for (size_t i = 0; encodings[i] != wxFONTENCODING_SYSTEM; i++)
139 {
140 if ( !wxGetNativeFontEncoding(encodings[i], &info) ||
7520f3da 141 !wxTestFontEncoding(info) )
32b8ec41
VZ
142 continue;
143 if ( !OnFontEncoding(family, encodingNames[i]) )
144 break;
145 }
146
7520f3da 147 return true;
32b8ec41 148}