Previous IDL Reference Guide: Fonts Next

About Hershey Vector Fonts

Figure H-10: Hershey Font

Figure H-10: Hershey Font

The Hershey vector fonts used by IDL were digitized by Dr. A.V. Hershey of the Naval Weapons Laboratory. Characters in the vector fonts are stored as equations, and can be scaled and rotated in three dimensions. They are drawn as lines on the current graphics device, and are displayed quickly and efficiently by IDL. The Hershey vector fonts are built into IDL itself, and are always available.

All the available fonts are illustrated in Hershey Vector Font Samples. The default Hershey vector font is Font 3, Simplex Roman.

Using Hershey Vector Fonts

To use the Hershey vector font system with IDL Direct Graphics, either set the value of the IDL system variable !P.FONT equal to -1 (negative one), or set the FONT keyword of one of the Direct Graphics routines equal to -1. The vector font system is the default font system for IDL. To use the vector font system with IDL Object Graphics, consult Creating Font Objects.

Once the vector font system is selected, use an embedded formatting command to select a vector font (or fonts) for each string (see Embedded Formatting Commands for details). The font selected "sticks" from string to string; that is, if you change fonts in one string, future strings will use the new font until you change it again or exit IDL.

For example, to use the Duplex Roman Hershey vector font for the title of a plot, you would use a command that looks like this:

PLOT, mydata, TITLE="!5Title of my plot"  

Also see the following to modify the characteristics of a TrueType font:

ISO Latin 1 Encoding

The default Hershey vector font (Font 3, Simplex Roman) follows the ISO Latin 1 Encoding scheme and contains many international characters. The illustration of this font under Hershey Vector Font Samples can be used to find the octal codes for the special characters.

For example, suppose you want to display some text with an Angstrom symbol in it. Looking at the chart of font 3, we see that the Angstrom symbol has octal code 305. Non-printable characters can be represented in IDL using octal or hexadecimal notation and the STRING function (see Non-Printing Characters for details). So the Angstrom can be printed by inserting a STRING("305B) character in the text string as follows:

XYOUTS,.1, .5, 'Here is an Angstrom symbol: ' + STRING("305B), $  

Customizing the Hershey Vector Fonts

The EFONT procedure is a widget application that allows you to edit the Hershey fonts and save the results. Use this routine to add special characters or completely new, custom fonts to the Hershey fonts.

  IDL Online Help (June 16, 2005)