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.
  1. Find the .ttf file of your favorite true type font (ex: ilovethisfont.ttf)
  2. Go to your idl directory (on a Mac, /Applications/itt/idlxx/) and then to resource/fonts/tt/
  3. Open the file ttfont.map in a text editor
  4. 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
  5. Restart IDL
  6. 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'
However, for quality publications, postscript fonts are recommended. Personally, I use

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 /Applications/itt/idlxx/resource/fonts/ps/font.map (see existing lines)

Comments

Popular Posts