I recently had an annoying experience uploading a manuscript to ScholarOne’s Manuscript Central. I learned the hard way that Manuscript Central does not support Type 3 PostScript fonts in PDF documents, and the Python plotting library, matplotlib
, uses Type 3 fonts by default.
So, I had to figure out how to make matplotlib
not use Type 3 fonts in PostScript and PDF outputs. I was surprised to find very little information on the interweb about how to do this.
I finally stumbled across an example matplotlibrc
, and after some searching found two key settings: pdf.fonttype
and ps.fonttype
. You have to change these settings from the default of 3
to the alternative 42
. You can do this in your matplotlibrc
file with:
Or, you can change these settings in your code using:
This causes matplotlib
to use Type 42 (a.k.a. TrueType) fonts for PostScript and PDF files. This allows you to avoid Type 3 fonts without limiting yourself to the stone-age technology of Type 1 fonts.
After specifying this setting, I was able to re-run all my plotting scripts, and update my PDFs (there were a lot of them!) to TrueType fonts without any noticeable difference in the images.
In my googleing, I found other folks had used
to force matplotlib
to produce Type 1 fonts. However, this caused some of the fonts to look quite different in the plots, and also garbled some of the text where my strings conflicted with TeX syntax.
In general, for fellow matplotlib
ers out there, this example matplotlibrc
file turns out to be a nice resource for all the ways you can tweak your favorite plotting tool.