PrintDefineFont

Description

Creates a numbered font definition that consists of a font supported by your printer and a set of font properties. You can use the font number in the PrintSetFont or PrintText functions. You can define up to eight fonts at a time.

Syntax

PrintDefineFont ( printjobnumber, fontnumber, facename, height, weight, fontpitch, fontfamily, italic, underline )

Argument

Description

printjobnumber

The number the PrintOpen function assigned to the print job.

fontnumber

The number (1 to 8) you want to assign to the font.

facename

A string whose value is the name of a typeface supported by your printer (for example, Courier 10Cpi).

height

An integer whose value is the height of the type in thousandths of an inch (for example, 250 for 18-point 10Cpi) or a negative number representing the point size (for example, -18 for 18-point). Specifying the point size is more exact; the height in thousandths of an inch only approximates the point size.

weight

The stroke weight of the type. Normal weight is 400 and bold is 700.

fontpitch

A value of the FontPitch enumerated datatype indicating the pitch of the font:

Default!

Fixed!

Variable!

fontfamily

A value of the FontFamily enumerated datatype indicating the family of the font:

AnyFont!

Decorative!

Modern!

Roman!

Script!

Swiss!

italic

A boolean value indicating whether the font is italic. The default is false (not italic).

underline

A boolean value indicating whether the font is underlined. The default is false (not underlined).


Return value

Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument's value is null, PrintDefineFont returns null.

Usage

You can use as many as eight fonts in one print job. If you require more than eight fonts in one job, you can call PrintDefineFont again to change the settings for a font number.

Use PrintSetFont to make a font number the current font for the open print job.

Fonts in Microsoft Windows

Although the fontfamily argument seems to duplicate information in the font name, Windows uses it along with the font name to identify the correct font or substitute a similar font if the named font is unavailable.

Font names and sizes

Some font names include a size, especially monospaced fonts which include characters per inch. This is the recommended size for the font and does not affect the printed size, which you specify with the height argument.

Examples

These statements define a new blank page, and then define print font 1 for Job as Courier 10Cpi, 18 point, normal weight, default pitch, Decorative font, with no italic or underline:

long Job
Job = PrintOpen()
PrintDefineFont(Job, 1, "Courier 10Cpi", &
   -18, 400, Default!, Decorative!, FALSE, FALSE)

See also

PrintClose

PrintOpen

PrintSetFont