From 2d3ee70ed37ed2120d5c5f75277172620e32084c Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Sat, 11 Jan 2014 19:09:55 +1030 Subject: ps: cairo_set_page_size does not need to be in eps output --- src/cairo-ps-surface.c | 68 ++++++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 32 deletions(-) diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c index 5dd33fa..f66c195 100644 --- a/src/cairo-ps-surface.c +++ b/src/cairo-ps-surface.c @@ -335,38 +335,42 @@ _cairo_ps_surface_emit_header (cairo_ps_surface_t *surface) " cairo_store_point /cairo_font where { pop cairo_selectfont } if } bind def\n" "/g { setgray } bind def\n" "/rg { setrgbcolor } bind def\n" - "/d1 { setcachedevice } bind def\n" - "/cairo_set_page_size {\n" - " %% Change paper size, but only if different from previous paper size otherwise\n" - " %% duplex fails. PLRM specifies a tolerance of 5 pts when matching paper size\n" - " %% so we use the same when checking if the size changes.\n" - " /setpagedevice where {\n" - " pop currentpagedevice\n" - " /PageSize known {\n" - " 2 copy\n" - " currentpagedevice /PageSize get aload pop\n" - " exch 4 1 roll\n" - " sub abs 5 gt\n" - " 3 1 roll\n" - " sub abs 5 gt\n" - " or\n" - " } {\n" - " true\n" - " } ifelse\n" - " {\n" - " 2 array astore\n" - " 2 dict begin\n" - " /PageSize exch def\n" - " /ImagingBBox null def\n" - " currentdict end\n" - " setpagedevice\n" - " } {\n" - " pop pop\n" - " } ifelse\n" - " } {\n" - " pop\n" - " } ifelse\n" - "} def\n"); + "/d1 { setcachedevice } bind def\n"); + + if (!surface->eps) { + _cairo_output_stream_printf (surface->final_stream, + "/cairo_set_page_size {\n" + " %% Change paper size, but only if different from previous paper size otherwise\n" + " %% duplex fails. PLRM specifies a tolerance of 5 pts when matching paper size\n" + " %% so we use the same when checking if the size changes.\n" + " /setpagedevice where {\n" + " pop currentpagedevice\n" + " /PageSize known {\n" + " 2 copy\n" + " currentpagedevice /PageSize get aload pop\n" + " exch 4 1 roll\n" + " sub abs 5 gt\n" + " 3 1 roll\n" + " sub abs 5 gt\n" + " or\n" + " } {\n" + " true\n" + " } ifelse\n" + " {\n" + " 2 array astore\n" + " 2 dict begin\n" + " /PageSize exch def\n" + " /ImagingBBox null def\n" + " currentdict end\n" + " setpagedevice\n" + " } {\n" + " pop pop\n" + " } ifelse\n" + " } {\n" + " pop\n" + " } ifelse\n" + "} def\n"); + } _cairo_output_stream_printf (surface->final_stream, "%%%%EndProlog\n"); -- cgit v1.2.3