Click or drag to resize

GetFont Function

X#
Displays the Font dialog box and returns information about the font you choose.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.19
Syntax
 FUNCTION GetFont(
	cFontName,
	nFontSize,
	cFontStyle,
	nFontCharSet
) AS STRING CLIPPER
Request Example View Source

Parameters

cFontName (Optional)
Type: Usual
Specifies the name of the font initially selected in the Font dialog box. If the font you specify is not installed, the default font is selected initially.
nFontSize (Optional)
Type: Usual
Specifies the font size selected initially in the Font dialog box. If the font size you specify is not supported, the default font size is selected initially. If you omit nFontSize or if nFontSize is less than or equal to zero, the font size selected defaults to 10 point.
Note Note
The dialog box permits you to select sizes between and
1127
, inclusive. You can specify other values for nFontSize when calling the GetFont function; no error occurs. If you do so, however, the user must select a size within the designated range of values before clicking OK in the dialog box. Otherwise, the dialog box displays an alert and does not accept the value.
cFontStyle (Optional)
Type: Usual
Specifies the font style selected initially in the Font dialog box or to display only those fonts available on the selected printer. If the font style you specify is not supported, the default font style is selected initially.
The table in the remarks section lists the values available for cFontStyle.
nFontCharSet (Optional)
Type: Usual
Specifies a value for the language script. The values you can specify differ depending on your version of Windows.
Note Note
Omitting this value disables the script drop-down list in the dialog box.
The table in the remarks section describes some example values for nFontCharSet.
Note Note
If you specify 1 for nFontCharSet, the dialog box that GetFont( ) opened displays the default language script on the operating system. GetFont( ) never returns 1 because it returns the value for the language script selected in the GetFont( ) dialog box.
For more information, see FontCharSet Property.

Return Value

Type: String
Character. GetFont( ) returns one of the following, depending on certain conditions:
    Remarks
    cFontStyleDescription
    BSelect Bold font style initially.
    ISelect Italic font style initially.
    BISelect Bold Italic font style initially.
    PDisplay only those fonts available on the current default printer.

    nFontCharSetLanguage script
    0Western
    1Default
    2Symbol
    128Japanese
    161Greek
    162Turkish
    163Vietnamese
    177Hebrew
    178Arabic
    186Baltic
    204Cyrillic
    238Central European
    Examples
    X#
     1* Invoke the dialog with script drop-down list disabled:
     2? GetFont("Arial",12,"B") // press OK in the dialog box
     3* return value is the string:
     4* "Arial,12,B"
     5* Enable the script drop-down list, Western script selected:
     6? GetFont("Arial",12,"B",0) // press OK after selections
     7* sample return value is the string:
     8* "Verdana,16,N,161"
     9* Return from the dialog box without making a selection:
    10? GetFont("Arial",12,"B") // press Cancel in the dialog box
    11* return value is an empty string
    12? GetFont("Arial",12,"B",0) // press Cancel in the dialog box
    13* return value is still an empty string
    See Also