]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/fontenum.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxFontEnumerator
4 // Author: wxWidgets team
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxFontEnumerator
12 wxFontEnumerator enumerates either all available fonts on the system or only
13 the ones with given attributes - either only fixed-width (suited for use in
14 programs such as terminal emulators and the like) or the fonts available in
17 To do this, you just have to call one of EnumerateXXX() functions - either
18 wxFontEnumerator::EnumerateFacenames() or wxFontEnumerator::EnumerateEncodings()
19 and the corresponding callback (wxFontEnumerator::OnFacename() or
20 wxFontEnumerator::OnFontEncoding()) will be called repeatedly until either
21 all fonts satisfying the specified criteria are exhausted or the callback
24 @section fontenum_virtual Virtual functions to override
26 Either OnFacename or OnFontEncoding should be overridden depending on
27 whether you plan to call EnumerateFacenames or EnumerateEncodings.
28 Of course, if you call both of them, you should override both functions.
33 @see @ref overview_fontencoding, @ref page_samples_font, wxFont, wxFontMapper
35 class wxFontEnumerator
39 virtual ~wxFontEnumerator();
42 Call OnFontEncoding() for each encoding supported by the given font -
43 or for each encoding supported by at least some font if @a font is not specified.
45 virtual bool EnumerateEncodings(const wxString
& font
= wxEmptyString
);
48 Call OnFacename() for each font which supports given encoding (only if
49 it is not @c wxFONTENCODING_SYSTEM) and is of fixed width
50 (if @a fixedWidthOnly is @true).
52 Calling this function with default arguments will result in enumerating all
53 fonts available on the system.
55 virtual bool EnumerateFacenames(wxFontEncoding encoding
= wxFONTENCODING_SYSTEM
,
56 bool fixedWidthOnly
= false);
59 Return array of strings containing all encodings found by
62 static wxArrayString
GetEncodings(const wxString
& facename
= wxEmptyString
);
65 Return array of strings containing all facenames found by
68 static wxArrayString
GetFacenames(wxFontEncoding encoding
= wxFONTENCODING_SYSTEM
,
69 bool fixedWidthOnly
= false);
72 Returns @true if the given string is valid face name, i.e. it's the face name
73 of an installed font and it can safely be used with wxFont::SetFaceName.
75 static bool IsValidFacename(const wxString
& facename
);
78 Called by EnumerateFacenames() for each match.
80 Return @true to continue enumeration or @false to stop it.
82 virtual bool OnFacename(const wxString
& font
);
85 Called by EnumerateEncodings() for each match.
87 Return @true to continue enumeration or @false to stop it.
89 virtual bool OnFontEncoding(const wxString
& font
,
90 const wxString
& encoding
);