AFONT( ) Function
Places information about available fonts, such as their names, into an array.
![]() |
---|
You can also use AFONT( ) to determine available font sizes or if a font is scalable. To display a dialog box containing available fonts, font sizes, and styles, use the GETFONT( ) function. For more information, see GETFONT( ) Function. |
AFONT(ArrayName [, cFontName [, nFontSize | nFontCharSet [, nFlags]]]) |
Parameters
- ArrayName
-
Specifies the variable array into which the names of available fonts are placed. If the array is not large enough to contain all the fonts, Visual FoxPro automatically increases the size of the array. If you specify an existing two-dimensional array, Visual FoxPro changes the array to a one-dimensional array.
- cFontName
-
Specifies a font for which information is placed into the array.
If the font you specify supports only discrete font sizes (8-point, 10-point, ...), the font sizes are stored to the array, and AFONT( ) returns True (.T.). If the font you specify in cFontName is scalable (supports fractional font size values), the array has a single element containing –1, and AFONT( ) returns True (.T.).
If the font you specify is not available, the array is not created, and AFONT( ) returns False (.F.).
- nFontSize
-
Specifies a size for the font specified in cFontName.
If the font size nFontSize is available for the font specified in cFontName, the array has a single element containing a True (.T.) value, and AFONT( ) returns True (.T.). If the font size is not available for the specified font, the array is not created, and AFONT( ) returns False (.F.).
- nFontCharSet
-
Specifies a character set for the font specified in cFontName. If the font character set specified is available for the font specified in cFontName, the array has a single element containing a True (.T.) value, and AFONT( ) returns True (.T.). If the font character set is not available for the specified font, the array is not created, and AFONT( ) returns False (.F.).
- nFlags
-
Controls whether the third parameter passed is treated as the font size or font character set.
The following table describes behavior for various nFlags values specified.
nFlags Description Omitted or 0 for the first bit
Third parameter is treated as a font size value.
If third parameter is -1, array is updated with all available font sizes for the font specified in cFontName for nonproportional fonts, such as MS Sans Serif, and AFONT( ) returns True (.T.). This behavior in Visual FoxPro 8.0 and later is equivalent to passing only the first two parameters.
Note
In versions prior to Visual FoxPro 8.0, if you specified any negative or positive font size for a non-proportional font, AFONT( ) returned False (.F.).
If the third parameter passed is 0, for nonproportional fonts, AFONT( ) returns False (.F.) for Visual FoxPro 8.0 and later. However, the behavior for proportional fonts such as TrueType or OpenType (Arial) has not changed.
1
Third parameter is treated as a font character set. Array is populated with character sets available for the specified font.
If the third parameter passed is -1, array is updated with all available font character sets for the font specified in cFontName.
Return Value
Remarks
Example
See Also
© , 1996-2020 • Updated: 11/10/20
Comment or report problem with topic