]>
Commit | Line | Data |
---|---|---|
b3c86150 VS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: src/dfb/fontenum.cpp | |
3 | // Purpose: wxFontEnumerator class | |
4 | // Author: Vaclav Slavik | |
5 | // Created: 2006-08-10 | |
b3c86150 VS |
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" | |
4e1d79d3 | 18 | #include "wx/private/fontmgr.h" |
b3c86150 | 19 | |
63feebce VS |
20 | #if wxUSE_FONTENUM |
21 | ||
b3c86150 VS |
22 | // ---------------------------------------------------------------------------- |
23 | // wxFontEnumerator | |
24 | // ---------------------------------------------------------------------------- | |
25 | ||
4e1d79d3 VS |
26 | bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding, |
27 | bool fixedWidthOnly) | |
b3c86150 | 28 | { |
4e1d79d3 VS |
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; | |
b3c86150 VS |
47 | } |
48 | ||
4e1d79d3 | 49 | bool wxFontEnumerator::EnumerateEncodings(const wxString& facename) |
b3c86150 | 50 | { |
4e1d79d3 | 51 | return EnumerateEncodingsUTF8(facename); |
b3c86150 | 52 | } |
63feebce VS |
53 | |
54 | #endif // wxUSE_FONTENUM |