Name
GetAvailableFonts -- retrieve list of available fonts (V4.7)
Synopsis
t = GetAvailableFonts()
Function
This function scans all fonts installed on the current computer, puts them into a table, and returns the information to you. This is useful to check if a specific font is available without calling SetFont() or OpenFont().

The table returned by this function will consist of several subtables. One subtable for each font. The subtables have the following elements initialized:

Name:
The complete font name (i.e. family name plus style). For example, "Arial Bold Italic".

Family:
The family name of this font, e.g. "Arial".

Weight:
The weight of this font. This will be set to one of the following weight constants:

 
#FONTWEIGHT_THIN
#FONTWEIGHT_EXTRALIGHT
#FONTWEIGHT_ULTRALIGHT
#FONTWEIGHT_LIGHT
#FONTWEIGHT_BOOK
#FONTWEIGHT_NORMAL
#FONTWEIGHT_REGULAR
#FONTWEIGHT_MEDIUM
#FONTWEIGHT_SEMIBOLD
#FONTWEIGHT_DEMIBOLD
#FONTWEIGHT_BOLD
#FONTWEIGHT_EXTRABOLD
#FONTWEIGHT_ULTRABOLD
#FONTWEIGHT_HEAVY
#FONTWEIGHT_BLACK
#FONTWEIGHT_EXTRABLACK
#FONTWEIGHT_ULTRABLACK

Slant:
The slant style of this font. This will be set to one of the following slant constants:

 
#FONTSLANT_ROMAN
#FONTSLANT_ITALIC
#FONTSLANT_OBLIQUE

Bitmap:
True if this font is a bitmap font, False if it is a vector font. Vector fonts can be freely transformed and antialiased.

Sizes:
If the font is a bitmap font this will be a table containing a list of available sizes for the font. If the font is a vector font, this table will be empty.

Please note that there is no guarantee that all calls to OpenFont() or SetFont() will succeed with the fonts returned by this function. It can often happen that OpenFont() and SetFont() will fail with a specific font although it was returned in the available table by this function. This is because GetAvailableFonts() returns the available fonts for all Hollywood font engines. When you call OpenFont() or SetFont(), however, only one font engine can be specified. So if a call to OpenFont() fails although the font was returned by GetAvailableFonts(), then this is a sign that you are using the wrong font engine to open this font. Simply switch font engines in that case and it should work correctly.

Inputs
none

Results
t
a table containing all available fonts
Example
t = GetAvailableFonts()
For Local k = 0 To ListItems(t) - 1
  DebugPrint("Family:", t[k].Family, "Weight:", t[k].Weight,
             "Slant:", t[k].Slant, "Bitmap:", t[k].Bitmap)
Next
The code above lists all fonts available on this system.

Show TOC