From 59eff46fdf201f6269daf5fa101eafdf4f881e30 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Fri, 13 Jan 2006 13:41:45 +0000 Subject: [PATCH] Fix things up to conform with Adobe PostScript Document Structuring Conventions Specification. Thanks to Michael Sweet for bringing several items to our attention. Things that are fixed: Add Pages: (atend) to header, add Pages: N to trailer, properly advertise DocumentData of Binary rather than Clean7Bit, remove fictitious EndPage, move showpage to after the grestore. --- ChangeLog | 12 ++++++++++++ src/cairo-ps-surface.c | 25 +++++++++---------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 60dd26477..1daf28870 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2006-01-13 Carl Worth + + * src/cairo-ps-surface.c: (_cairo_ps_surface_emit_header), + (_cairo_ps_surface_emit_footer), (_cairo_ps_surface_end_page), + (_cairo_ps_surface_copy_page), (_cairo_ps_surface_show_page): Fix + things up to conform with Adobe PostScript Document Structuring + Conventions Specification. Thanks to Michael Sweet for bringing + several items to our attention. Things that are fixed: Add Pages: + (atend) to header, add Pages: N to trailer, properly advertise + DocumentData of Binary rather than Clean7Bit, remove fictitious + EndPage, move showpage to after the grestore. + 2006-01-13 Carl Worth * src/cairo-paginated-surface.c: diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c index 98ebd9928..bf0039883 100644 --- a/src/cairo-ps-surface.c +++ b/src/cairo-ps-surface.c @@ -94,15 +94,9 @@ _cairo_ps_surface_emit_header (cairo_ps_surface_t *surface) "%%!PS-Adobe-3.0\n" "%%%%Creator: cairo (http://cairographics.org)\n" "%%%%CreationDate: %s" - "%%%%Title: Some clever title\n" -#if DONE_ADDING_PAGES_SUPPORT_AFTER_SWITCHING_TO_PAGINATED - "%%%%Pages: %d\n" -#endif + "%%%%Pages: (atend)\n" "%%%%BoundingBox: %f %f %f %f\n", ctime (&now), -#if DONE_ADDING_PAGES_SUPPORT_AFTER_SWITCHING_TO_PAGINATED - surface->pages.num_elements, -#endif 0.0, 0.0, surface->width, surface->height); @@ -110,7 +104,7 @@ _cairo_ps_surface_emit_header (cairo_ps_surface_t *surface) /* The "/FlateDecode filter" currently used is a feature of * LanguageLevel 3 */ _cairo_output_stream_printf (surface->stream, - "%%%%DocumentData: Clean7Bit\n" + "%%%%DocumentData: Binary\n" "%%%%LanguageLevel: 3\n" "%%%%Orientation: Portrait\n" "%%%%EndComments\n"); @@ -121,7 +115,9 @@ _cairo_ps_surface_emit_footer (cairo_ps_surface_t *surface) { _cairo_output_stream_printf (surface->stream, "%%%%Trailer\n" - "%%%%EOF\n"); + "%%%%Pages: %d\n" + "%%%%EOF\n", + surface->num_pages); } static cairo_surface_t * @@ -294,9 +290,6 @@ _cairo_ps_surface_end_page (cairo_ps_surface_t *surface) _cairo_output_stream_printf (surface->stream, "grestore\n"); - _cairo_output_stream_printf (surface->stream, - "%%%%EndPage\n"); - surface->need_start_page = TRUE; } @@ -305,10 +298,10 @@ _cairo_ps_surface_copy_page (void *abstract_surface) { cairo_ps_surface_t *surface = abstract_surface; - _cairo_output_stream_printf (surface->stream, "copypage\n"); - _cairo_ps_surface_end_page (surface); + _cairo_output_stream_printf (surface->stream, "copypage\n"); + return CAIRO_STATUS_SUCCESS; } @@ -317,10 +310,10 @@ _cairo_ps_surface_show_page (void *abstract_surface) { cairo_ps_surface_t *surface = abstract_surface; - _cairo_output_stream_printf (surface->stream, "showpage\n"); - _cairo_ps_surface_end_page (surface); + _cairo_output_stream_printf (surface->stream, "showpage\n"); + surface->need_start_page = TRUE; return CAIRO_STATUS_SUCCESS;