summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2014-01-11 19:09:55 +1030
committerAdrian Johnson <ajohnson@redneon.com>2014-01-11 20:57:34 +1030
commit2d3ee70ed37ed2120d5c5f75277172620e32084c (patch)
treeb0b6f3271ff5240ac23fa2960bd71135a4773f6f
parent26d0edbc35504624cbe96e95e338351e219bb262 (diff)
ps: cairo_set_page_size does not need to be in eps output
-rw-r--r--src/cairo-ps-surface.c68
1 files 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");