Share via


GETFONT( ) Function

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

GETFONT(cFontName [, nFontSize [, cFontStyle [, nFontCharSet])

Return Values

Character

Parameters

  • 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
  • nFontCharSet
    Specifies the language script value. The following table describes some available values for nFontCharSet.
    nFontCharSet Language Script
    1 Western
    2 Symbol
    77 Mac
    128 Japanese
    161 Greek
    162 Turkish
    163 Vietnamese
    177 Hebrew
    178 Arabic
    186 Baltic
    204 Cyrillic
    238 Central European
    255 OEM/DOS

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. If you pass nFontCharSet value, the selected font script is included in the returned string.

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.

See Also

FONTMETRIC( ) | SYSMETRIC( ) | TXTWIDTH( ) | WFONT( )