Adding TrueType or Postscript fonts to IDL
IDL plots can look quite ugly at times. One way to improve their look is by using other fonts than the default fonts. Here is how. I'll first tell you how to add a true type font and then a postscript font.
This command is equivalent to
You can also add a Postscript font in a similar way by adding a line in the file/Applications/itt/idlxx/resource/fonts/ps/font.map (see existing lines)
- Find the .ttf file of your favorite true type font (ex:
ilovethisfont.ttf ) - Go to your idl directory (on a Mac,
/Applications/itt/idlxx/ ) and then toresource/fonts/tt/ - Open the file
ttfont.map in a text editor - Add a line to it with the following information:
- the name that you want to give to your font (how you want to call it within IDL) between quotes (Ex: "This_is_my_font")
- the .ttf file name (
ilovethisfont.ttf ) - two numbers that can be set to 1.0 (that have to do with the scaling of the font)
- the line should look like:
"This_is_my_font" ilovethisfont.ttf 1.0 1.0
- Restart IDL
- You can now use your font by
- setting your device to true type fonts:
IDL> !p.font = 1
- changing the device font:
IDL> device, /tt_font, set_font='This_is_my_font'
- setting your device to true type fonts:
IDL> !p.font = 0 ;; Device fonts
IDL> device, /schoolbook ;; New Century Schoolbook
This command is equivalent to
IDL> device, set_font='NewCenturySchlbk-Roman'
You can also add a Postscript font in a similar way by adding a line in the file
Comments
Post a Comment