about Grigoris Maravelias
MNRAS and eps font type

MNRAS and eps font type

I was ready to submit my revised version at the MNRAS site, when I encountered some difficulties that I didn’t expected (although I knew that there would be some!).

So, you have to upload a complete file of your paper (either pdf or ps) along with the source files (images, tex files, etc). At my first attempt their automatic online pdf tool fail to work properly and the error was:

“We are sorry, but there is a problem with your submitted file(s) named ….pdf. Our system cannot process this file. The most common reason for this is badly embedded fonts or Type 3 fonts (which we do not support at the moment). If possible, please change the font settings and/or redistil this PDF to a lower Adobe Acrobat version and try again.

and by reading more (‘Read more’ link):

“A Type 3 font error is due to bit mapped fonts in your document or missing fonts used within the document. Bitmapped fonts display poorly on screen in PDF files and sometimes cause printing problems. We recommend for Word Documents that you embed your fonts and re-upload the file(s), or for PDF’s save them using Acrobat 6 (or lower).”

I tried their proposed solutions (adding the LaTeX packages: \usepackage[T1]{fontenc} and \usepackage{aecompl} , and trying also the \pdfminorversion=5) but nothing worked out. Then I tried to look around to see if there was any related post but nothing obvious (1; even though close). At some point, probably when I understood the context of the ‘Read more’, I uploaded the pdf file with text only and it worked! That means that there was a problem with font type of the images. I uploaded again the pdf file with only one image and the site refused to create the pdf file like before. I re-tried with an image that I hadn’t created myself and that one worked! So, definitely the problem was with my images, as produced through matplotlib.

At first I searched and asked various lists for an relatively easy way to the change the font type of the eps images by editing them somehow, without success (2 for example did not work, I didn’t try ps2ps/gs and psfrag, GIMP could also do it but the quality was lower). Since I was pressed by the deadline I decided not to look around for side-ways but proceed with brute force: re-create all plots! Although this didn’t involve any serious data processing (only to read some files), yet it was a serious amount of time since for many of plots I had to re-assign manually some plot parameters. Moreover, I had to find how to do it within matplotlib.

Thankfully, that was not that hard to perform. Following a similar post (3) I found the appropriate parameter inside the matplotlibrc for the postscript files: ps.fonttype
for which there are two options: “3” for Type3 fonts and “42” for TrueType. The default value is “3”, so by adding the line

from matplotlib import rcParams
rcParams['ps.fonttype'] = 42

in my scripts I could save the plots with the appropriate font type (I could of course change the default value but for some reason I thought not to do it know). All plots were done … all? except one, for which I did not understand why it kept been saved with type3 fonts – for that I used GIMP!

And finally … the paper was submitted!

[1]: tex.stackexchange.com – How do I avoid Type3 fonts when submitting to ManuscriptCentral
[2]: osmanoglu.org – Embed fonts in EPS/PDF
[3]: stackoverflow.com – Cannot edit text in chart exported by Matplotlib and opened in Illustrator


  1. grigoris

    Ok, now the above worked fine for all my plots but one! I (still) cannot understand why there was an issue with that one, since when I was not plotting the legend everything was ok but when the legend was on a Type 3 font was still present!
    After passing from a LaTeX procedure to produce the final pdf I was getting:

    name type emb sub uni object ID
    [none] Type 3 yes no no 160 0

    so something was still there! After a lot of search I bumped on a post discussing [1] exactly the same question, where they proposed to change these parameteres:

    rcParams[‘ps.useafm’] = True
    rcParams[‘pdf.use14corefonts’] = True
    rcParams[‘text.usetex’] = True

    …and the plot was indeed saved with Type 1 fonts! Hooray!

    I did some tests to see if all of these were necessary and it seems (at least in my case) that only the last parameter was useful (test.usetex). Even rcParams[‘ps.fonttype’] = 42 didn’t seem necessary!

    Another note is that dvipng has to be installed before adding these lines (or else matplotlib will complain and it will show you nothing)

    [1]: http://nerdjusttyped.blogspot.gr/2010/07/type-1-fonts-and-matplotlib-figures.html

  2. Daniele

    This is old but still a current problem.

    I found the problem sometimes is in the (automatic) conversion from eps to pdf files.
    Everything is good if saved directly to pdf in matplotlib.

Leave a Reply

Your email address will not be published. Required fields are marked *