From 10f642b99ffb069137fbde0d1f340f086f0552df Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 28 May 2008 01:43:34 +0000 Subject: [PATCH] =?UTF-8?q?=20=20=20=20=20=20=20=20Bug=20509788=20?= =?UTF-8?q?=E2=80=93=20GTK+=20should=20use=20CUPS=20to=20set=20Postscript?= =?UTF-8?q?=20level=20of=20PS=20output?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * modules/printbackends/cups/gtkprintbackendcups.c (cups_printer_create_cairo_surface): Fall back to PostScript level 2 if the printer does not support level 3. Patch by Marek Kašík. svn path=/trunk/; revision=20203 --- ChangeLog | 10 +++++++++- .../printbackends/cups/gtkprintbackendcups.c | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3033953608..28fe251a69 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,14 @@ 2008-05-27 Matthias Clasen - Bug 404571 – Scroll arrow backgrounds should be painted with different + Bug 509788 - GTK+ should use CUPS to set Postscript level of PS output + + * modules/printbackends/cups/gtkprintbackendcups.c + (cups_printer_create_cairo_surface): Fall back to PostScript level 2 + if the printer does not support level 3. Patch by Marek Kašík. + +2008-05-27 Matthias Clasen + + Bug 404571 - Scroll arrow backgrounds should be painted with different detail * gtk/gtkmenu.c (gtk_menu_paint): Use "menu_scroll_arrow_up/down" diff --git a/modules/printbackends/cups/gtkprintbackendcups.c b/modules/printbackends/cups/gtkprintbackendcups.c index e45decfd5e..0a0c4e97b0 100644 --- a/modules/printbackends/cups/gtkprintbackendcups.c +++ b/modules/printbackends/cups/gtkprintbackendcups.c @@ -307,11 +307,30 @@ cups_printer_create_cairo_surface (GtkPrinter *printer, GIOChannel *cache_io) { cairo_surface_t *surface; + ppd_file_t *ppd_file = NULL; + ppd_attr_t *ppd_attr = NULL; + int level = 2; /* TODO: check if it is a ps or pdf printer */ surface = cairo_ps_surface_create_for_stream (_cairo_write_to_cups, cache_io, width, height); + ppd_file = gtk_printer_cups_get_ppd (GTK_PRINTER_CUPS (printer)); + + if (ppd_file != NULL) + { + ppd_attr = ppdFindAttr (ppd_file, "LanguageLevel", NULL); + + if (ppd_attr != NULL) + level = atoi (ppd_attr->value); + } + + if (level == 2) + cairo_ps_surface_restrict_to_level (surface, CAIRO_PS_LEVEL_2); + + if (level == 3) + cairo_ps_surface_restrict_to_level (surface, CAIRO_PS_LEVEL_3); + /* TODO: DPI from settings object? */ cairo_surface_set_fallback_resolution (surface, 300, 300);