Fonts on Linux

Dealing with fonts under Linux can sometimes be tricky. The important issues in dealing with fonts in Mathematica are presented in this tutorial for your convenience.

Font Formats

The Mathematica front end supports BDF, TrueType, and Type1 fonts. These fonts are automatically installed by MathInstaller during installation.

Font Installation

All machines that display the front end must have access to the fonts included with Mathematica. If the Mathematica process is running on a remote machine and the front end is displayed on the local machine, the X server on the local machine must know where to find the Mathematica fonts. To do this, add the Mathematica fonts to the local font path by running a command like the following on the local machine.

xset fp+ /usr/local/Wolfram/Mathematica/9.0/SystemFiles/Fonts/Type1; xset fp rehash

Be sure to execute xset fp rehash to make the fonts available to the local X server.

For optimal onscreen performance, Type1 fonts should appear before BDF fonts in the font path. Hence, $InstallationDirectory/SystemFiles/Fonts/Type1 should appear before $InstallationDirectory/SystemFiles/Fonts/BDF. You can check the order of the font path by executing the command xset q.

Note: TrueType fonts are automatically loaded and do not require an xset command.

Font Servers

You may prefer not to install local copies of the Mathematica fonts on all machines. You can instead set up a font server with all the necessary Mathematica fonts. The other machines on the network can then find the fonts as needed by reading them from the Mathematica directory on the font server. Consult your operating system's documentation for further information.

Common Font Errors

On some systems, the font path is limited in length, and it is possible to receive xset: bad font path element errors even if the fonts are available to the server. In this case, try reordering the font path and adding the directories for the Mathematica fonts earlier in the path. The directory $InstallationDirectory/SystemFiles/Fonts/Type1 must be listed before $InstallationDirectory/SystemFiles/Fonts/BDF on the font path for optimal onscreen performance.

Fonts and Printing

When the X front end prints a notebook, it uses AFM files for the font metrics needed for printing. If you want to print using a particular font not included with Mathematica, you will need the AFM files for the font. These files are installed in either $InstallationDirectory/Configuration/Fonts/AFM, /usr/lib/AFM, or /usr/lib/afm. Fonts are normally downloaded to the printer by the front end when printing. You may be able to download the fonts and store them on the printer. See the documentation and programs that came with your printer for more information.

GhostScript

If you want to view Mathematica graphics using GhostScript, you need to make GhostScript aware of the Mathematica fonts. For more information, contact Technical Support by sending email to support@wolfram.com, or visit support.wolfram.com/mathematica/graphics/export/ghostscript.html.

New to Mathematica? Find your learning path »
Have a question? Ask support »