Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b28d757

Browse files
committed
ps: Explicitly set language level to 3
We currently use various operators from level 2: - `<<` - `>>` - `colorimage` - `glyphshow` - `makepattern` - `rectfill` - `selectfont` - `setpagedevice` - `setpattern` and from level 3: - `ShadingType` - `shfill` - Type 42 fonts, possibly without any conditions or fallback, so we should be explicit about what we require. This is already part of the xpdf distiller at level 2, but not ghostscript. Since the distiller is optional though, we shouldn't rely on that.
1 parent 110c774 commit b28d757

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/matplotlib/backends/backend_ps.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,8 @@ def print_figure_impl(fh):
914914
f"%%DocumentPaperSizes: {papertype}\n"
915915
f"%%Pages: 1\n",
916916
end="", file=fh)
917-
print(f"{dsc_comments}\n"
917+
print(f"%%LanguageLevel: 3\n"
918+
f"{dsc_comments}\n"
918919
f"%%Orientation: {orientation.name}\n"
919920
f"{get_bbox_header(bbox)[0]}\n"
920921
f"%%EndComments\n",
@@ -1024,6 +1025,7 @@ def _print_figure_tex(
10241025
tmppath.write_text(
10251026
f"""\
10261027
%!PS-Adobe-3.0 EPSF-3.0
1028+
%%LanguageLevel: 3
10271029
{dsc_comments}
10281030
{get_bbox_header(bbox)[0]}
10291031
%%EndComments
@@ -1196,7 +1198,7 @@ def xpdf_distill(tmpfile, eps=False, ptype='letter', bbox=None, rotated=False):
11961198
"-dEPSCrop" if eps else "-sPAPERSIZE#%s" % ptype,
11971199
tmpfile, tmppdf], _log)
11981200
cbook._check_and_log_subprocess(
1199-
["pdftops", "-paper", "match", "-level2", tmppdf, tmpps], _log)
1201+
["pdftops", "-paper", "match", "-level3", tmppdf, tmpps], _log)
12001202
shutil.move(tmpps, tmpfile)
12011203
if eps:
12021204
pstoeps(tmpfile)

0 commit comments

Comments
 (0)