From: scislac Date: Sun, 27 Sep 2009 17:31:38 +0000 (+0000) Subject: Patch from Adrian for 437550. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=0166de21319dc989a33128e8cd2a969b2f919cf9;hp=71e828c2a578057f747982e0a477dcb98085b01f;p=inkscape.git Patch from Adrian for 437550. --- diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 364dfcfa8..cae496543 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -755,6 +755,8 @@ CairoRenderContext::setupSurface(double width, double height) _height = height; cairo_surface_t *surface = NULL; + cairo_matrix_t ctm; + cairo_matrix_init_identity (&ctm); switch (_target) { case CAIRO_SURFACE_TYPE_IMAGE: surface = cairo_image_surface_create(_target_format, (int)ceil(width), (int)ceil(height)); @@ -766,11 +768,19 @@ CairoRenderContext::setupSurface(double width, double height) #endif #ifdef CAIRO_HAS_PS_SURFACE case CAIRO_SURFACE_TYPE_PS: - surface = cairo_ps_surface_create_for_stream(Inkscape::Extension::Internal::_write_callback, _stream, width, height); -#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 5, 2)) + if (!_eps && width > height) { + surface = cairo_ps_surface_create_for_stream(Inkscape::Extension::Internal::_write_callback, _stream, height, width); + cairo_matrix_init (&ctm, 0, -1, 1, 0, 0, 0); + cairo_matrix_translate (&ctm, -width, 0); + cairo_ps_surface_dsc_begin_page_setup (surface); + cairo_ps_surface_dsc_comment (surface, "%%PageOrientation: Landscape"); + } else { + surface = cairo_ps_surface_create_for_stream(Inkscape::Extension::Internal::_write_callback, _stream, width, height); + } if(CAIRO_STATUS_SUCCESS != cairo_surface_status(surface)) { return FALSE; } +#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 5, 2)) cairo_ps_surface_restrict_to_level (surface, (cairo_ps_level_t)_ps_level); cairo_ps_surface_set_eps (surface, (cairo_bool_t) _eps); #endif @@ -781,7 +791,7 @@ CairoRenderContext::setupSurface(double width, double height) break; } - return _finishSurfaceSetup (surface); + return _finishSurfaceSetup (surface, &ctm); } bool