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