X
4785

How to change the fonts on the printer DEVICE

How do I change the fonts for the printer DEVICE? 

First, switch to the printer device. Then, store the list of available fonts into a variable using the SET_FONT and GET_FONTNAMES keywords to the DEVICE routine. The value of the SET_FONT keyword should be set to a wildcard string ('*') in order to retrieve all available fonts. The GET_FONTNAMES keyword should be set equal to an undefined variable (in this case, fontnames), which will contain the names of the available fonts upon completion of the command.

IDL> SET_PLOT, 'PRINTER'
IDL> DEVICE, SET_FONT = '*', GET_FONTNAMES = fontnames

From these next two commands, you can see how many fonts are available and their names. The GET_FONTNAMES keyword returns an array of strings. In this case, there are 38 elements in the fontnames array:

IDL> help, fontnames
FONTNAMES STRING = Array[66]

IDL> print, fontnames+','
Courier, LinePrinter, CG Times, Univers, Univers Condensed, Antique Olive, Garamond, CG Omega, Albertus Medium, Albertus Extra Bold,
Clarendon Condensed, Coronet, Letter Gothic, Marigold, Arial, Symbol, Times New Roman, Wingdings, Arial, Arial CE, Arial CYR,
Arial Greek, Arial TUR, Courier New, Courier New CE, Courier New CYR, Courier New Greek, Courier New TUR, Lucida Console,
Lucida Sans Unicode, Times New Roman, Times New Roman CE, Times New Roman CYR, Times New Roman Greek, Times New Roman TUR,
Wingdings, Symbol, Verdana, Arial Black, Comic Sans MS, Impact, Georgia, Palatino Linotype, Tahoma, Trebuchet MS, Webdings,
Microsoft Sans Serif, Arial Narrow, Book Antiqua, Bookman Old Style, Century Gothic, Garamond, Haettenschweiler, Monotype Corsiva,
MS Outlook, Wingdings 2, Wingdings 3, ENVI Symbols, Swis721 BT, Dutch801 Rm BT, Courier10 BT, SymbolProp BT, SymbolMono BT, Roman,
Script, Modern, ...


You can then change the font setting for the device through the use of the SET_FONT keyword to DEVICE. The value passed to SET_FONT can be a literal string, as in the following case:

IDL> DEVICE, SET_FONT = 'Wingdings 3'

Or the value can be set a unique element of the fontnames array:

IDL> DEVICE, SET_FONT = fontnames[56]

You can then verify the font currently being used by the device through the use of the GET_CURRENT_FONT keyword to the DEVICE routine.

IDL> DEVICE, GET_CURRENT_FONT = currentFont
IDL> PRINT, currentFont
Wingdings 3


Review on 12/31/2013 MM