Setting rcParams ps.fonttype = 42 yields unreadable eps

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Setting rcParams ps.fonttype = 42 yields unreadable eps

I created a bug report at, but in the mean time I am keen to get some help from this user group.

I'm trying to create an eps output from matplotlib 2.0.2 with editable text (truetype). I've used the settings:

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

Which yields a file size increase from 19Kb to 1.2Mb, but no software (MacOS Preview, or Adobe Photoshop 2017) can read the file. For those interested I have attached both `*.eps` output files in the zip archive at the link at the top of the page.

The truetype (ps.fonttype = 42) file contains the following, and `DejaVu Sans` doesn't appear to be installed (checking the MacOS Font Book application):
%%Title: DejaVu Sans
%%Copyright: Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved. DejaVu changes are in public domain
%%Creator: Converted from TrueType to type 42 by PPR

A demo script to reproduce the problem is:

import matplotlib
from matplotlib import pyplot as plt
fig = plt.figure(dpi=100, facecolor='w', edgecolor='w')
ax1 = plt.subplot2grid((2,2), (0, 0), rowspan=2, facecolor='w')
ax2 = plt.subplot2grid((2,2), (0, 1), facecolor='w')
ax3 = plt.subplot2grid((2,2), (1, 1), facecolor='w')
matplotlib.rcParams['ps.fonttype'] = 3
fig.savefig('demo-type3.eps') <- Opens fine
matplotlib.rcParams['ps.fonttype'] = 42
fig.savefig('demo-type42.eps') <- Errors on all applications I have tried

System config:
  * Operating System: MacOS 10.11.6
  * Matplotlib Version: 2.0.2-py27_1 (conda-forge)
  * Python Version: 2.7.13-1 (conda-forge)
  * Jupyter Version (if applicable): NA (1.0.0-py27_0 conda-forge)
  * Other Libraries: NA (can provide if required)
  * Installation path: conda (conda-forge channel)

Happy to hear any tips as to how to get around this issue.