Skip to content

Commit 4512594

Browse files
committed
Do not distill and embed fonts if no text
1 parent efaedd8 commit 4512594

File tree

1 file changed

+29
-28
lines changed

1 file changed

+29
-28
lines changed

lib/matplotlib/backends/backend_ps.py

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,34 +1063,35 @@ def _print_figure_tex(
10631063
""",
10641064
encoding="latin-1")
10651065

1066-
if orientation is _Orientation.landscape: # now, ready to rotate
1067-
width, height = height, width
1068-
bbox = (lly, llx, ury, urx)
1069-
1070-
# set the paper size to the figure size if is_eps. The
1071-
# resulting ps file has the given size with correct bounding
1072-
# box so that there is no need to call 'pstoeps'
1073-
if is_eps:
1074-
paper_width, paper_height = orientation.swap_if_landscape(
1075-
self.figure.get_size_inches())
1076-
else:
1077-
if papertype == 'auto':
1078-
papertype = _get_papertype(width, height)
1079-
paper_width, paper_height = papersize[papertype]
1080-
1081-
psfrag_rotated = _convert_psfrags(
1082-
tmppath, ps_renderer.psfrag, paper_width, paper_height,
1083-
orientation.name)
1084-
1085-
if (mpl.rcParams['ps.usedistiller'] == 'ghostscript'
1086-
or mpl.rcParams['text.usetex']):
1087-
_try_distill(gs_distill,
1088-
tmppath, is_eps, ptype=papertype, bbox=bbox,
1089-
rotated=psfrag_rotated)
1090-
elif mpl.rcParams['ps.usedistiller'] == 'xpdf':
1091-
_try_distill(xpdf_distill,
1092-
tmppath, is_eps, ptype=papertype, bbox=bbox,
1093-
rotated=psfrag_rotated)
1066+
if ps_renderer.psfrag:
1067+
if orientation is _Orientation.landscape: # now, ready to rotate
1068+
width, height = height, width
1069+
bbox = (lly, llx, ury, urx)
1070+
1071+
# set the paper size to the figure size if is_eps. The
1072+
# resulting ps file has the given size with correct bounding
1073+
# box so that there is no need to call 'pstoeps'
1074+
if is_eps:
1075+
paper_width, paper_height = orientation.swap_if_landscape(
1076+
self.figure.get_size_inches())
1077+
else:
1078+
if papertype == 'auto':
1079+
papertype = _get_papertype(width, height)
1080+
paper_width, paper_height = papersize[papertype]
1081+
1082+
psfrag_rotated = _convert_psfrags(
1083+
tmppath, ps_renderer.psfrag, paper_width, paper_height,
1084+
orientation.name)
1085+
1086+
if (mpl.rcParams['ps.usedistiller'] == 'ghostscript'
1087+
or mpl.rcParams['text.usetex']):
1088+
_try_distill(gs_distill,
1089+
tmppath, is_eps, ptype=papertype, bbox=bbox,
1090+
rotated=psfrag_rotated)
1091+
elif mpl.rcParams['ps.usedistiller'] == 'xpdf':
1092+
_try_distill(xpdf_distill,
1093+
tmppath, is_eps, ptype=papertype, bbox=bbox,
1094+
rotated=psfrag_rotated)
10941095

10951096
_move_path_to_path_or_stream(tmppath, outfile)
10961097

0 commit comments

Comments
 (0)