GETFONT( ) Function

See Also

Displays the Font dialog box and returns the name of the font you choose.

Syntax

GETFONT(cFontName [, nFontSize [, cFontStyle)

Returns

Character

Arguments

cFontName

Specifies the name of the font initially selected in the Font dialog box. If the font you specify hasn't been installed, the default font is initially selected.

nFontSize

Specifies the font size initially selected in the Font dialog box. If the font size you specify isn't supported, the default font size is initially selected. The font size defaults to 10 point if nFontSize is less than or equal to zero or you omit nFontSize.

cFontStyle

Specifies the font style initially selected in the Font dialog box. If the font style you specify isn't supported, the default font style is initially selected. cFontStyle is one or two characters that specify the font style. The following table lists the characters that you can specify for cFontStyle and the corresponding font style.

Character Font style
B Bold
I Italic
BI Bold Italic

Remarks

GETFONT( ) returns the name, size, and style of the font you choose. Your choice is returned as a character string with the font name, size, and style separated by commas.

GETFONT( ) returns the empty string if you exit the Font dialog box by choosing Cancel, choosing Close from the Control menu, or pressing ESC.

cMyFont = GETFONT( , , 'B')

Note   Visual FoxPro commands and functions can be abbreviated to four characters. In the case of GETFONT( ) and GETFILE( ), which both begin with the same four letters, precedence is given to GETFILE( ). Issuing GETF( ) displays the Open dialog box.