Before a program can display text in a particular
font, it must know which of the initialized fonts to use.
makes one of the
initialized fonts the current (or "active") font. SETFONT has the following
result =SETFONT (options)
The function's argument consists of letter codes that
describe the desired font: typeface, character height and width in pixels,
fixed or proportional, and attributes such as bold or italic. These options are
discussed in detail in the SETFONT entry in the
Intel® Visual Fortran Compiler User and Reference Guides
INTEGER(2) index, numfonts
numfonts = INITIALIZEFONTS ( )
index = SETFONT('t''Cottage''h18w10')
This sets the typeface to Cottage, the character
height to 18 pixels and the width to 10 pixels.
The following example sets the typeface to Arial, the
character height to 14, with proportional spacing and italics (the pi codes):
index = SETFONT('t''Arial''h14pi')
successfully sets the
font, it returns the font's index number. If the function fails, it returns a
negative integer. Call
to find the source
of the problem; its return value indicates why the function failed. If you call
fonts, a run-time error occurs.
updates the font information when it is used to select a font.
can be used to
obtain information about the currently selected font.
sets the user fields in the
type (a derived type
defined in DFLIB.MOD), and
user-selected values. The following user fields are contained in
INTEGER(2) type ! 1 = truetype, 0 = bit map
INTEGER(2) ascent ! Pixel distance from top to baseline
INTEGER(2) pixwidth ! Character width in pixels, 0=prop
INTEGER(2) pixheight ! Character height in pixels
INTEGER(2) avgwidth ! Average character width in pixels
CHARACTER(32) facename ! Font name
END TYPE fontinfo
To find the parameters of the current font, call
. For example:
TYPE (fontinfo) font
INTEGER(2) i, numfonts
numfonts = INITIALIZEFONTS()
i = SETFONT ( ' t ' 'Arial ' )
i = GETFONTINFO(font)
WRITE (*,*) font.avgwidth, font.pixheight, font.pixwidth
After you initialize the fonts and make one the
active font, you can display the text on the screen.
To display text on the
screen after selecting a font:
Select a starting position for the text with
Optionally, set a text display angle with
Send the text to the screen (in the current font)
moves the current graphics point to the pixel coordinates passed to it when it
is invoked. This becomes the starting position of the upper-left corner of the
first character in the text.
can set the
text's orientation in increments of one-tenth of a degree.