Cicode Programming Reference > Cicode Function Categories > Display Functions Introduction > DspFont

DspFont

Creates a font and returns a font handle. If the requested font already exists, its font handle is returned. You can use this font handle in the functions that display text, buttons, and text files.

If the exact font size does not exist, the closest font size is used.

Syntax

DspFont(FontType, PixelSize, ForeOnColor, BackOnColor [, ForeOffColor] [, BackOffColor] )

FontType:

The font type, for example, "Helv".

PixelSize:

The font size, as a positive number for pixels, or a negative number for points.

ForeOnColor:

The foreground color used for the text. If implementing flashing color, this is the initial color that will be used. Select a color from the list of Predefined Color Names and Codes or create an RGB-based color using the function MakeCitectColor.

BackOnColor:

The color used for the background of text. If implementing flashing color, this is the initial color that will be used. Select a color from the list of Predefined Color Names and Codes or create an RGB-based color using the function MakeCitectColor.

ForeOffColor:

An optional argument only required if implementing flashing color for the font foreground. It represents the secondary color used. Select a color from the list of Predefined Color Names and Codes or create an RGB-based color using the function MakeCitectColour.

BackOffColor:

An optional argument only required if implementing flashing color for the font background. It represents the secondary color used. Select a color from the list of Predefined Color Names and Codes or create an RGB-based color using the function MakeCitectColour.

Return Value

The font handle as an integer. If the font cannot be created, -1 is returned. The font handle identifies the table where all data on the associated font is stored.

Related Functions

DspFontHnd, DspText, DspButton, DspButtonFn, DspFile

Example

Font = DspFont("Helv", -12, White, Red);
DspText(20, Font, "Text in Helv Font");
/* Displays "Text in Helv Font" in 12-point Helvetica font in white on red at AN20. */
Font = DspFont("Helv", 24, White, Red, Black);
DspText(20, Font, "Text in Helv Font");
/* Displays "Text in Helv Font" in 24 pixel Helvetica font in flashing black and white on red at AN20. */

See Also

Display Functions