Skip to content

Commit 7c9dd2c

Browse files
committed
Fix eps distillation bbox bug; closes 3032385
svn path=/branches/v1_0_maint/; revision=8906
1 parent d8c134c commit 7c9dd2c

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

lib/matplotlib/backends/backend_ps.py

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,7 +1363,8 @@ def gs_distill(tmpfile, eps=False, ptype='letter', bbox=None, rotated=False):
13631363
operators. The output is low-level, converting text to outlines.
13641364
"""
13651365

1366-
paper_option = "-sPAPERSIZE=%s" % ptype
1366+
if eps: paper_option = "-dEPSCrop"
1367+
else: paper_option = "-sPAPERSIZE=%s" % ptype
13671368

13681369
psfile = tmpfile + '.ps'
13691370
outfile = tmpfile + '.output'
@@ -1385,14 +1386,6 @@ def gs_distill(tmpfile, eps=False, ptype='letter', bbox=None, rotated=False):
13851386
shutil.move(psfile, tmpfile)
13861387

13871388

1388-
# While it is best if above steps preserve the original bounding
1389-
# box, it does not seems to be the case. pstoeps not only convert
1390-
# the input to eps format, but also restores the original bbox.
1391-
1392-
if eps:
1393-
pstoeps(tmpfile, bbox, rotated=rotated)
1394-
1395-
13961389
def xpdf_distill(tmpfile, eps=False, ptype='letter', bbox=None, rotated=False):
13971390
"""
13981391
Use ghostscript's ps2pdf and xpdf's/poppler's pdftops to distill a file.
@@ -1432,17 +1425,9 @@ def xpdf_distill(tmpfile, eps=False, ptype='letter', bbox=None, rotated=False):
14321425
os.remove(tmpfile)
14331426
shutil.move(psfile, tmpfile)
14341427

1435-
1436-
# Similar to the gs_distillier case, ps2pdf does not seem to
1437-
# preserve the bbox of the original file (at least w/ gs
1438-
# 8.61). Thus, the original bbox need to be resotred.
1439-
1440-
if eps:
1441-
pstoeps(tmpfile, bbox, rotated)
14421428
for fname in glob.glob(tmpfile+'.*'):
14431429
os.remove(fname)
14441430

1445-
14461431
def get_bbox_header(lbrt, rotated=False):
14471432
"""
14481433
return a postscript header stringfor the given bbox lbrt=(l, b, r, t).

0 commit comments

Comments
 (0)