]> git.saurik.com Git - wxWidgets.git/blame - src/dfb/fontenum.cpp
Applied patch from Bo, WIP
[wxWidgets.git] / src / dfb / fontenum.cpp
CommitLineData
b3c86150
VS
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"
4e1d79d3 19#include "wx/private/fontmgr.h"
b3c86150
VS
20
21// ----------------------------------------------------------------------------
22// wxFontEnumerator
23// ----------------------------------------------------------------------------
24
4e1d79d3
VS
25bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
26 bool fixedWidthOnly)
b3c86150 27{
4e1d79d3
VS
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;
b3c86150
VS
46}
47
4e1d79d3 48bool wxFontEnumerator::EnumerateEncodings(const wxString& facename)
b3c86150 49{
4e1d79d3 50 return EnumerateEncodingsUTF8(facename);
b3c86150 51}