back to gui 

wxFontEnumerator

generated from ../src/mod_gui/misc/fontenum.cpp

Use wxFontEnumerator to enumerate all available fonts. See wxFont, wxFontEncoding

The following example shows a dialog which contains a listbox with the names of all the available fonts.


   var dlg = new wxDialog(null,
                          -1,
                         "Font Enumerating example");

   // Create a wxFontEnumerator
   var enumerator = new wxFontEnumerator();
   // Set a funtion to onFacename. To get all available fonts return true. 
   // No arguments need to be specified, because they are not used.

   enumerator.onFacename = function()
   {
     return true;
   };

   // Use enumerateFaceNames to start the enumeration.
   enumerator.enumerateFacenames();

   // Now the property facenames contains all the font names.
   var listbox = new wxListBox(dlg, -1, wxDefaultPosition, wxDefaultSize, enumerator.facenames);
  

Constants

Class Properties

Name Type Description
encodings read only Array Array of strings containing all encodings found by enumerateEncodings. Returns undefined when this function is not called.
facenames read only Array Array of strings containing all facenames found by enumerateFacenames. Returns undefined when this function is not called.
onFacename Function A function which receives the font and encoding as arguments. When the function returns true, the font is added to facenames. When no function is set, all available fonts are added.
onFontEncoding Function A function which receives the encoding as argument. The encoding is added to encodings when the function returns true.

Constructor

wxFontEnumerator

wxFontEnumerator()
 

Creates a wxFontEnumerator object.

Methods

enumerateEncodings

enumerateEncodings(Font = "") : Boolean
 
Name Type Default Description
Font String A font name.

The function set on the onFontEncoding is called for each encoding supported by the given font. When no function is set all encodings are reported. See onFontEncoding, encodings

enumerateFaceNames

enumerateFaceNames(FontEncoding = wxFontEncoding.SYSTEM, 
                   FixedWidthOnly = false) : Boolean
 
Name Type Default Description
FontEncoding Integer wxFontEncoding.SYSTEM The encoding.
FixedWidthOnly Boolean false Only report fonts with fixed width or not.

This will call the function which is set to the onFacename property for each font which supports the given encoding. When this function returns true for the the given font, it will be added to facenames. When no function is specified, all fonts will be added to facenames. See also wxFontEncoding, facenames, onFacename




Design downloaded from Zeroweb.org: Free website templates, layouts, and tools.