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