Version: 3.1.0
wxFontEnumerator Class Reference

#include <wx/fontenum.h>

Detailed Description

wxFontEnumerator enumerates either all available fonts on the system or only the ones with given attributes - either only fixed-width (suited for use in programs such as terminal emulators and the like) or the fonts available in the given encoding).

To do this, you just have to call one of EnumerateXXX() functions - either wxFontEnumerator::EnumerateFacenames() or wxFontEnumerator::EnumerateEncodings() and the corresponding callback (wxFontEnumerator::OnFacename() or wxFontEnumerator::OnFontEncoding()) will be called repeatedly until either all fonts satisfying the specified criteria are exhausted or the callback returns false.

Virtual functions to override

Either OnFacename or OnFontEncoding should be overridden depending on whether you plan to call EnumerateFacenames or EnumerateEncodings. Of course, if you call both of them, you should override both functions.

Library:  wxCore
Category:  Graphics Device Interface (GDI)
See Also
Font Encodings, Font Sample, wxFont, wxFontMapper

Public Member Functions

 wxFontEnumerator ()
 
virtual ~wxFontEnumerator ()
 
virtual bool EnumerateEncodings (const wxString &font=wxEmptyString)
 Call OnFontEncoding() for each encoding supported by the given font - or for each encoding supported by at least some font if font is not specified.
 
virtual bool EnumerateFacenames (wxFontEncoding encoding=wxFONTENCODING_SYSTEM, bool fixedWidthOnly=false)
 Call OnFacename() for each font which supports given encoding (only if it is not wxFONTENCODING_SYSTEM) and is of fixed width (if fixedWidthOnly is true).
 
virtual bool OnFacename (const wxString &font)
 Called by EnumerateFacenames() for each match.
 
virtual bool OnFontEncoding (const wxString &font, const wxString &encoding)
 Called by EnumerateEncodings() for each match.
 

Static Public Member Functions

static wxArrayString GetEncodings (const wxString &facename=wxEmptyString)
 Return array of strings containing all encodings found by EnumerateEncodings().
 
static wxArrayString GetFacenames (wxFontEncoding encoding=wxFONTENCODING_SYSTEM, bool fixedWidthOnly=false)
 Return array of strings containing all facenames found by EnumerateFacenames().
 
static bool IsValidFacename (const wxString &facename)
 Returns true if the given string is valid face name, i.e.
 

Constructor & Destructor Documentation

wxFontEnumerator::wxFontEnumerator ( )
virtual wxFontEnumerator::~wxFontEnumerator ( )
virtual

Member Function Documentation

virtual bool wxFontEnumerator::EnumerateEncodings ( const wxString font = wxEmptyString)
virtual

Call OnFontEncoding() for each encoding supported by the given font - or for each encoding supported by at least some font if font is not specified.

virtual bool wxFontEnumerator::EnumerateFacenames ( wxFontEncoding  encoding = wxFONTENCODING_SYSTEM,
bool  fixedWidthOnly = false 
)
virtual

Call OnFacename() for each font which supports given encoding (only if it is not wxFONTENCODING_SYSTEM) and is of fixed width (if fixedWidthOnly is true).

Calling this function with default arguments will result in enumerating all fonts available on the system.

static wxArrayString wxFontEnumerator::GetEncodings ( const wxString facename = wxEmptyString)
static

Return array of strings containing all encodings found by EnumerateEncodings().

static wxArrayString wxFontEnumerator::GetFacenames ( wxFontEncoding  encoding = wxFONTENCODING_SYSTEM,
bool  fixedWidthOnly = false 
)
static

Return array of strings containing all facenames found by EnumerateFacenames().

static bool wxFontEnumerator::IsValidFacename ( const wxString facename)
static

Returns true if the given string is valid face name, i.e.

it's the face name of an installed font and it can safely be used with wxFont::SetFaceName.

virtual bool wxFontEnumerator::OnFacename ( const wxString font)
virtual

Called by EnumerateFacenames() for each match.

Return true to continue enumeration or false to stop it.

virtual bool wxFontEnumerator::OnFontEncoding ( const wxString font,
const wxString encoding 
)
virtual

Called by EnumerateEncodings() for each match.

Return true to continue enumeration or false to stop it.