wxRuby Documentation Home

# Wx::FontEnumerator

FontEnumerator 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
enumerate_facenames or
enumerate_encodings and the
corresponding callback (on_facename or
on_font_encoding) will be called
repeatedly until either all fonts satisfying the specified criteria are
exhausted or the callback returns false.

## Virtual functions to override

Either on_facename or
on_font_encoding should be overridden
depending on whether you plan to call
enumerate_facenames or
enumerate_encodings. Of course,
if you call both of them, you should override both functions.

## Derived from

None

## See also

Font encoding overview,
Font sample,
Font,
FontMapper

## Methods

- FontEnumerator#enumerate_facenames
- FontEnumerator#enumerate_encodings
- FontEnumerator#get_encodings
- FontEnumerator#get_facenames
- FontEnumerator#on_facename
- FontEnumerator#on_font_encoding

### FontEnumerator#enumerate_facenames

Boolean enumerate_facenames( FontEncoding encoding = FONTENCODING_SYSTEM, Boolean fixedWidthOnly = false)

Call on_facename for each font which
supports given encoding (only if it is not FONTENCODING_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.

### FontEnumerator#enumerate_encodings

Boolean enumerate_encodings(%(arg-type)String% font = "")

Call on_font_encoding for each
encoding supported by the given font – or for each encoding supported by at
least some font if font is not specified.

### FontEnumerator#get_encodings

ArrayString get_encodings()

Return array of strings containing all encodings found by
enumerate_encodings. This is convenience function. It is
based on default implementation of on_font_encoding so don’t expect
it to work if you overwrite that method.

### FontEnumerator#get_facenames

ArrayString get_facenames()

Return array of strings containing all facenames found by
enumerate_facenames. This is convenience function. It is
based on default implementation of on_facename so don’t expect
it to work if you overwrite that method.

### FontEnumerator#on_facename

Boolean on_facename(%(arg-type)String% font)

Called by enumerate_facenames for
each match. Return true to continue enumeration or false to stop it.

### FontEnumerator#on_font_encoding

Boolean on_font_encoding( String font, String encoding)

Called by enumerate_encodings for
each match. Return true to continue enumeration or false to stop it.

[This page automatically generated from the Textile source at 2023-06-09 00:45:29 +0000]