1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mgl/fontenum.cpp
3 // Purpose: wxFontEnumerator class for MGL
4 // Author: Vaclav Slavik
6 // Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
17 // ============================================================================
19 // ============================================================================
21 // ----------------------------------------------------------------------------
23 // ----------------------------------------------------------------------------
25 #include "wx/fontenum.h"
28 #include "wx/dynarray.h"
29 #include "wx/string.h"
33 #include "wx/encinfo.h"
34 #include "wx/fontutil.h"
35 #include "wx/private/fontmgr.h"
39 // ============================================================================
41 // ============================================================================
44 // ----------------------------------------------------------------------------
46 // ----------------------------------------------------------------------------
48 bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding
,
52 const wxFontBundleList
& list
= wxFontsManager::Get()->GetBundles();
53 wxFontBundleList::Node
*node
;
54 wxFontBundle
*f
= NULL
;
55 wxNativeEncodingInfo info
;
57 if ( encoding
!= wxFONTENCODING_SYSTEM
)
58 wxGetNativeFontEncoding(encoding
, &info
);
60 for (node
= list
.GetFirst(); node
; node
= node
->GetNext())
63 info
.facename
= f
->GetName();
64 if ( (!fixedWidthOnly
|| f
->IsFixed()) &&
65 (encoding
== wxFONTENCODING_SYSTEM
|| wxTestFontEncoding(info
)) )
68 if ( !OnFacename(f
->GetName()) )
76 bool wxFontEnumerator::EnumerateEncodings(const wxString
& family
)
78 static wxFontEncoding encodings
[] =
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
,
105 wxFONTENCODING_SYSTEM
108 static const char *encodingNames
[] =
135 wxNativeEncodingInfo info
;
136 info
.facename
= family
;
138 for (size_t i
= 0; encodings
[i
] != wxFONTENCODING_SYSTEM
; i
++)
140 if ( !wxGetNativeFontEncoding(encodings
[i
], &info
) ||
141 !wxTestFontEncoding(info
) )
143 if ( !OnFontEncoding(family
, encodingNames
[i
]) )