1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        src/dfb/fontenum.cpp
3 // Purpose:     wxFontEnumerator class
4 // Author:      Vaclav Slavik
5 // Created:     2006-08-10
6 // Copyright:   (c) 2006 REA Elektronik GmbH
7 // Licence:     wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9 
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
12 
13 
14 #include "wx/fontenum.h"
15 #include "wx/private/fontmgr.h"
16 
17 #if wxUSE_FONTENUM
18 
19 // ----------------------------------------------------------------------------
20 // wxFontEnumerator
21 // ----------------------------------------------------------------------------
22 
EnumerateFacenames(wxFontEncoding encoding,bool fixedWidthOnly)23 bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
24                                           bool fixedWidthOnly)
25 {
26     // we only support UTF-8 and system (which means "use any"):
27     if ( encoding != wxFONTENCODING_SYSTEM && encoding != wxFONTENCODING_UTF8 )
28         return false;
29 
30     bool found = false;
31     const wxFontBundleList& list = wxFontsManager::Get()->GetBundles();
32 
33     for ( wxFontBundleList::const_iterator f = list.begin(); f != list.end(); ++f )
34     {
35         if ( fixedWidthOnly && !(*f)->IsFixed() )
36             continue;
37 
38         found = true;
39         if ( !OnFacename((*f)->GetName()) )
40             break; // OnFacename() requests us to stop enumeration
41     }
42 
43     return found;
44 }
45 
EnumerateEncodings(const wxString & facename)46 bool wxFontEnumerator::EnumerateEncodings(const wxString& facename)
47 {
48     return EnumerateEncodingsUTF8(facename);
49 }
50 
51 #endif // wxUSE_FONTENUM
52