]>
Commit | Line | Data |
---|---|---|
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 | #if wxUSE_FONTENUM | |
22 | ||
23 | // ---------------------------------------------------------------------------- | |
24 | // wxFontEnumerator | |
25 | // ---------------------------------------------------------------------------- | |
26 | ||
27 | bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding, | |
28 | bool fixedWidthOnly) | |
29 | { | |
30 | // we only support UTF-8 and system (which means "use any"): | |
31 | if ( encoding != wxFONTENCODING_SYSTEM && encoding != wxFONTENCODING_UTF8 ) | |
32 | return false; | |
33 | ||
34 | bool found = false; | |
35 | const wxFontBundleList& list = wxFontsManager::Get()->GetBundles(); | |
36 | ||
37 | for ( wxFontBundleList::const_iterator f = list.begin(); f != list.end(); ++f ) | |
38 | { | |
39 | if ( fixedWidthOnly && !(*f)->IsFixed() ) | |
40 | continue; | |
41 | ||
42 | found = true; | |
43 | if ( !OnFacename((*f)->GetName()) ) | |
44 | break; // OnFacename() requests us to stop enumeration | |
45 | } | |
46 | ||
47 | return found; | |
48 | } | |
49 | ||
50 | bool wxFontEnumerator::EnumerateEncodings(const wxString& facename) | |
51 | { | |
52 | return EnumerateEncodingsUTF8(facename); | |
53 | } | |
54 | ||
55 | #endif // wxUSE_FONTENUM |