Skip to content

Setting rcParams ps.fonttype = 42 yields unreadable eps #9044

Closed
@durack1

Description

@durack1

I was just reading some notes in #5862, and it seems I'm hitting similar errors on MacOS/OS X (10.11.6) - in this case it doesn't appear that carriage returns are the issue. If I follow the guidance, and attempt to convert output to truetype fonts:

import matplotlib
matplotlib.rcParams['pdf.fonttype'] = 42 ; # pdf.fonttype : 42 # Output Type 3 (Type3) or Type 42 (TrueType)
matplotlib.rcParams['ps.fonttype'] = 42

My file size increases 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.
matplotlib2-postscriptFontIssue.zip

The truetype file contains the following, and DejaVu Sans doesn't appear to be installed (checking the MacOS Font Book application):

...
%!PS-TrueTypeFont-1.0-2.22937
%%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 below:

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions