Fonts Overview

Visual FoxPro can use the fonts you have installed. Fonts determine the appearance of displayed or printed text. In addition, fonts determine the position and size of controls.

Control Size and Position

In Visual FoxPro, the ScaleMode property for the Form on which a control is placed determines the control's size and position. If ScaleMode is set to Pixels (3), the size of a control is specified in pixels. If ScaleMode is set to Foxels (0), the size of a control is determined by the Form's current font and font size.

Foxel is a Visual FoxPro term that corresponds to the maximum height and average width of a character in the current font. The row height corresponds to the maximum height of a letter in the current font; the column width corresponds to the average width of a letter in the current font.

In Visual FoxPro, you can use decimal fractions for row and column coordinates to facilitate precise positioning of controls and output. In FoxPro for MS-DOS, fractional portions of row and column coordinates are ignored.

In Visual FoxPro, to determine or change the font for the main Visual FoxPro window, press SHIFT while you display the Format menu, then choose the Screen Font option. The font for a user-defined window can be specified by including the FONT clause when you create the window with DEFINE WINDOW.

Font Substitution

If you specify a font that is not available, Windows substitutes a font with similar font characteristics. Windows considers the point size, serif characteristics and the pitch of the font you request. A TrueType font is typically substituted. A raster or vector font is only substituted when the characteristics of the font you request closely match those of the raster or vector font.

Font Functions

Several functions can be used to return information about fonts and text in a specific font.

These functions include:

Function Description
AFONT( ) Places information about available fonts into an array.
FONTMETRIC( ) Returns font attributes for installed fonts.
GETFONT( ) Displays the Font dialog and returns the name of the font you choose.
SYSMETRIC( ) Returns the size of a display element.
SCOLS( ) Returns the number of columns available in the main Visual FoxPro window. Useful when centering text or controls in the main Visual FoxPro window.
SROWS( ) Returns the number of rows available in the main Visual FoxPro window.Useful when centering text or controls in the main Visual FoxPro window.
WCOLS( ) Returns the number of columns within the specified window.Useful when centering text or controls in a user-defined window.
WFONT( ) Returns the name, size or style of the current font for a window.
WROWS( ) Returns the number of columns within the specified window.Useful when centering text or controls in a user-defined window.

See Also

AFONT( ) | FONTMETRIC( ) | GETFONT( ) | SYSMETRIC( ) | ScaleMode Property | SCOLS( ) | SROWS( ) | WCOLS( ) | WFONT( ) | WROWS( )