]>
git.saurik.com Git - wxWidgets.git/blob - interface/fontenum.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxFontEnumerator
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxFontEnumerator
13 wxFontEnumerator enumerates either all available fonts on the system or only
14 the ones with given attributes - either only fixed-width (suited for use in
15 programs such as terminal emulators and the like) or the fonts available in
18 To do this, you just have to call one of EnumerateXXX() functions - either
19 wxFontEnumerator::EnumerateFacenames or
20 wxFontEnumerator::EnumerateEncodings and the
21 corresponding callback (wxFontEnumerator::OnFacename or
22 wxFontEnumerator::OnFontEncoding) will be called
23 repeatedly until either all fonts satisfying the specified criteria are
24 exhausted or the callback returns @false.
29 @see @ref overview_wxfontencodingoverview, @ref overview_samplefont "Font
30 sample", wxFont, wxFontMapper
32 class wxFontEnumerator
36 Call OnFontEncoding() for each
37 encoding supported by the given font - or for each encoding supported by at
38 least some font if @a font is not specified.
40 virtual bool EnumerateEncodings(const wxString
& font
= "");
43 Call OnFacename() for each font which
44 supports given encoding (only if it is not wxFONTENCODING_SYSTEM) and is of
45 fixed width (if @a fixedWidthOnly is @true).
46 Calling this function with default arguments will result in enumerating all
47 fonts available on the system.
49 virtual bool EnumerateFacenames(wxFontEncoding encoding
= wxFONTENCODING_SYSTEM
,
50 bool fixedWidthOnly
= false);
53 Return array of strings containing all encodings found by
56 static wxArrayString
GetEncodings(const wxString
& facename
= "");
59 Return array of strings containing all facenames found by
62 static wxArrayString
GetFacenames(wxFontEncoding encoding
= wxFONTENCODING_SYSTEM
,
63 bool fixedWidthOnly
= false);
66 Returns @true if the given string is valid face name, i.e. it's the face name
68 font and it can safely be used with wxFont::SetFaceName.
70 static bool IsValidFacename(const wxString
& facename
);
73 Called by EnumerateFacenames() for
74 each match. Return @true to continue enumeration or @false to stop it.
76 virtual bool OnFacename(const wxString
& font
);
79 Called by EnumerateEncodings() for
80 each match. Return @true to continue enumeration or @false to stop it.
82 virtual bool OnFontEncoding(const wxString
& font
,
83 const wxString
& encoding
);