]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/fontenum.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxFontEnumerator
4 // Author: wxWidgets team
6 // Licence: wxWindows license
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
19 wxFontEnumerator::EnumerateEncodings and the
20 corresponding callback (wxFontEnumerator::OnFacename or
21 wxFontEnumerator::OnFontEncoding) will be called
22 repeatedly until either all fonts satisfying the specified criteria are
23 exhausted or the callback returns @false.
28 @see @ref overview_wxfontencodingoverview, @ref overview_samplefont "Font
29 sample", wxFont, wxFontMapper
31 class wxFontEnumerator
35 Call OnFontEncoding() for each
36 encoding supported by the given font - or for each encoding supported by at
37 least some font if @a font is not specified.
39 virtual bool EnumerateEncodings(const wxString
& font
= "");
42 Call OnFacename() for each font which
43 supports given encoding (only if it is not wxFONTENCODING_SYSTEM) and is of
44 fixed width (if @a fixedWidthOnly is @true).
45 Calling this function with default arguments will result in enumerating all
46 fonts available on the system.
48 virtual bool EnumerateFacenames(wxFontEncoding encoding
= wxFONTENCODING_SYSTEM
,
49 bool fixedWidthOnly
= false);
52 Return array of strings containing all encodings found by
55 static wxArrayString
GetEncodings(const wxString
& facename
= "");
58 Return array of strings containing all facenames found by
61 static wxArrayString
GetFacenames(wxFontEncoding encoding
= wxFONTENCODING_SYSTEM
,
62 bool fixedWidthOnly
= false);
65 Returns @true if the given string is valid face name, i.e. it's the face name
67 font and it can safely be used with wxFont::SetFaceName.
69 static bool IsValidFacename(const wxString
& facename
);
72 Called by EnumerateFacenames() for
73 each match. Return @true to continue enumeration or @false to stop it.
75 virtual bool OnFacename(const wxString
& font
);
78 Called by EnumerateEncodings() for
79 each match. Return @true to continue enumeration or @false to stop it.
81 virtual bool OnFontEncoding(const wxString
& font
,
82 const wxString
& encoding
);