User Tools

Site Tools


setfont_specify_font_.htm
Navigation:  Language Reference > 13 - Built-in Functions >====== SETFONT (specify font) ====== Previous pageReturn to chapter overviewNext page

SETFONT( control , [ typeface ] , [ size ] , [ color ] , [ style ] ,[charset])

SETFONT( window , [ typeface ] , [ size ] , [ color ] , [ style ] ,[charset])

blk2blue.jpg

SETFONT Dynamically sets the display font for a control or window.
control A field number or field equate label for the control to affect. If control is zero (0), it specifies the WINDOW.
window Label of a WINDOW, APPLICATION or REPORT structure, or a value of the reference variable of the type &WINDOW, or a procedure parameter of the type WINDOW, or a built-in TARGET variable.
typeface A string constant or variable containing the name of the font. If omitted, the system font is used.
size An integer constant or variable containing the size (in points) of the font. If omitted, the system default font size is used.
color A LONG integer constant or variable containing the red, green, and blue values for the color of the font in the low-order three bytes, or an EQUATE for a standard Windows color value. If omitted, black is used.
style An integer constant, constant expression, EQUATE, or variable specifying the strike weight and style of the font. If omitted, the weight is normal.
charset A LONG integer variable specifying the character set value.

SETFONT dynamically specifies the display font for the control, overriding any FONT attribute. If the control parameter is zero (0), SETFONT specifies the default font for the window. However, this does not affect existing controls–only controls CREATEd after SETFONT executes are affected.

SETFONT allows you to specify all parameters of a font change at once, instead of one at a time as runtime property assignment allows. This has the advantage of implementing all changes at once, whereas runtime property assignment would change each individually, displaying each separate change as it occurs.

The typeface may name any font registered in the Windows system. The EQUATES.CLW file contains EQUATE values for standard style values. A style on the range zero (0) to one thousand (1000) specifies the strike weight of the font. You may also add values that indicate italic, underline, or strikeout text. The following EQUATES are in EQUATES.CLW:

FONT:thin EQUATE (100)
FONT:regular EQUATE (400)
FONT:bold EQUATE (700)
FONT:italic EQUATE (01000H)
FONT:underline EQUATE (02000H)
FONT:strikeout EQUATE (04000H)

When window is used as the first parameter, it allows you to change the window or report font both before and after opening them. If this form of SETFONT is called before a window or report opening, the FONT attribute in the window or report declaration is ignored COMPLETELY. Calling SETFONT before a window or report is opened needs to provide all of required aspects of the designated font, because all font settings in the window or report declaration are ignored rather than merged with the values given in the call to SETFONT.

Calling the SETFONT function with the window parameter after a window or report is opened is equivalent to the SETFONT(0,…) form with the control as the first parameter, with the exception that the opened window or report cannot be the current target. In addition a window or report that is not opened can not be the value of the built-in TARGET variable. So, the call

SETFONT (TARGET, …)

is changing the font settings of the active window in the current thread. If there are no active windows in the current thread, it is implicitly applied to the MDI frame window (if it exists), or simply ignored otherwise.

Example:

SETFONT(1,'Arial',14,,FONT:thin+FONT:Italic)            ! 14 pt. Arial black thin italic

SETFONT(QuickWindow,'Arial',14,,FONT:thin+FONT:Italic)  ! 14 pt. Arial black thin italic

                                                        ! for the entire window

See Also:

GETFONT , FONTDIALOG, FONTDIALOGA , FONT(set default font)

Font Support Quick Summary

setfont_specify_font_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1