]> git.ipfire.org Git - thirdparty/cups-filters.git/commitdiff
libcupsfilters: Moved IPP-attribute-related functions to ipp.c
authorTill Kamppeter <till.kamppeter@gmail.com>
Sat, 8 Oct 2022 06:34:42 +0000 (08:34 +0200)
committerTill Kamppeter <till.kamppeter@gmail.com>
Sat, 8 Oct 2022 06:34:42 +0000 (08:34 +0200)
There were some non-Raster-related but IPP-attribute-related functions
in raster.c. With this commit they are moved to ipp.c now.

The functions are:

    - cfGetBackSideOrientation()
    - cfGetPrintRenderIntent()
    - cfJoinJobOptionsAndAttrs()

cupsfilters/colord.c
cupsfilters/colormanager.c
cupsfilters/ghostscript.c
cupsfilters/ipp.c
cupsfilters/ipp.h
cupsfilters/mupdftopwg.c
cupsfilters/pwgtopdf.cxx
cupsfilters/raster.c
cupsfilters/raster.h
ppd/pdftops.c

index e58df834162225888ddd6c8cca2767df95f8c2d2..641a83157fdfdb92baee1fc0225a3849de1ee002 100644 (file)
@@ -31,7 +31,7 @@
 #include <stdio.h>
 #include <sys/types.h>
 #include <cupsfilters/filter.h>
-#include <cupsfilters/raster.h>
+#include <cupsfilters/ipp.h>
 #ifdef HAVE_DBUS
   #include <dbus/dbus.h>
 #endif
index 3d9f244dcb3657ce3d6eb365c3975b6dc95d571a..bce18f63fedfc676368e889e00deac7e4562f6f9 100644 (file)
@@ -28,7 +28,7 @@
 #include "colormanager.h"
 #include <cupsfilters/colord.h>
 #include <cupsfilters/filter.h>
-#include <cupsfilters/raster.h>
+#include <cupsfilters/ipp.h>
 
 
 #define CM_MAX_FILE_LENGTH 1024
index bd0209542c2f9fae75c1bcc874edc10593acd5df..6ce9cccbba82a842485ac99676eedbe911161b79 100644 (file)
@@ -23,6 +23,7 @@
 #include <cups/raster.h>
 #include <cupsfilters/colormanager.h>
 #include <cupsfilters/raster.h>
+#include <cupsfilters/ipp.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <signal.h>
index 116eb0dbcec512751e1299b27d185403856e44df..6956408b50bfe84d28dcbace2e8ff6a484c15e6b 100644 (file)
 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
 //  USA.
 //
+// Contents:
+//
+//   cfGetBackSideOrientation() - Return backside orientation for duplex
+//                                printing
+//   cfGetPrintRenderIntent()   - Return rendering intent for a job
+//   cfJoinJobOptionsAndAttrs() - Join job IPP attributes and job options in
+//                                one option list
+//
 
 //
 // Include necessary headers.
@@ -990,6 +998,271 @@ cfIPPReverseOutput(ipp_t *printer_attrs,
 }
 
 
+//
+//  'cfGetBackSideOrientation()' - This functions returns the back
+//                                side orientation using printer
+//                                attributes.  Meaning and reason for
+//                                backside orientation: It only makes
+//                                sense if printer supports duplex,
+//                                so, if printer reports that it
+//                                supports duplex printing via
+//                                sides-supported IPP attribute, then
+//                                it also reports back-side
+//                                orientation for each PDL in PDL
+//                                specific IPP attributes. Backside
+//                                orientation is specially needed for
+//                                raster PDLs as raster PDLs are
+//                                specially made for raster printers
+//                                which do not have sufficient memory
+//                                to hold a full page bitmap(raster
+//                                page).  So they cannot build the
+//                                whole page in memory before
+//                                starting to print it. For one-sided
+//                                printing it is easy to manage. The
+//                                printer's mechanism pulls the page
+//                                in on its upper edge and starts to
+//                                print, from top to bottom, after
+//                                that it ejects the page.  For
+//                                double-sided printing it does the
+//                                same for the front side, but for
+//                                the back side the mechanics of the
+//                                printer has to turn over the sheet,
+//                                and now, depending on how the sheet
+//                                is turned over it happens that the
+//                                edge arriving in the printing
+//                                mechanism is the lower edge of the
+//                                back side. And if the printer
+//                                simply prints then, the back side
+//                                is the wrong way around. The
+//                                printer reports its need via back
+//                                side orientation in such a case, so
+//                                that the client knows to send the
+//                                back side upside down for example.
+//                                In vector PDLs, PDF and PostScript,
+//                                always the full page's raster image
+//                                is completely generated in the
+//                                printer before the page is started,
+//                                and therefore the printer can start
+//                                to take the pixels from the lower
+//                                edge of the raster image if needed,
+//                                so back side orientation is always
+//                                "normal" for these PDLs.  And if a
+//                                printer does not support duplex,
+//                                back side orientation is not
+//                                needed.
+//
+
+int                                   // O - Backside orientation (bit 0-2)
+                                      //     Requires flipped margin?
+                                      //     Yes: bit 4 set; No: bit 3 set
+cfGetBackSideOrientation(cf_filter_data_t *data) // I - Filter data
+{
+  ipp_t *printer_attrs = data->printer_attrs;
+  int num_options = data->num_options;
+  cups_option_t *options = data->options;
+  char *final_content_type = data->final_content_type;
+  ipp_attribute_t *ipp_attr = NULL; // IPP attribute
+  int i,                       // Looping variable
+      count;
+  const char *keyword;
+  int backside = -1;   // backside obtained using printer attributes
+
+
+  // also check options
+  if ((ipp_attr = ippFindAttribute(printer_attrs, "sides-supported",
+                                  IPP_TAG_ZERO)) != NULL)
+  {
+    if (ippContainsString(ipp_attr, "two-sided-long-edge"))
+    {
+      if (final_content_type &&
+         strcasestr(final_content_type, "/urf") &&
+         (ipp_attr = ippFindAttribute(printer_attrs, "urf-supported",
+                                      IPP_TAG_ZERO)) != NULL)
+      {
+       for (i = 0, count = ippGetCount(ipp_attr); i < count; i ++)
+       {
+         const char *dm = ippGetString(ipp_attr, i, NULL); // DM value
+         if (!strcasecmp(dm, "DM1"))
+         {
+           backside = CF_BACKSIDE_NORMAL;
+           break;
+         }
+         if (!strcasecmp(dm, "DM2"))
+         {
+           backside = CF_BACKSIDE_FLIPPED;
+           break;
+         }
+         if (!strcasecmp(dm, "DM3"))
+         {
+           backside = CF_BACKSIDE_ROTATED;
+           break;
+         }
+         if (!strcasecmp(dm, "DM4"))
+         {
+           backside = CF_BACKSIDE_MANUAL_TUMBLE;
+           break;
+         }
+       }
+      }
+      else if ((final_content_type &&
+               strcasestr(final_content_type, "/vnd.pwg-raster") &&
+               (ipp_attr = ippFindAttribute(printer_attrs,
+                                            "pwg-raster-document-sheet-back",
+                                            IPP_TAG_ZERO)) != NULL) ||
+              (final_content_type &&
+               strcasestr(final_content_type, "/pclm") &&
+               (ipp_attr = ippFindAttribute(printer_attrs,
+                                            "pclm-raster-back-side",
+                                            IPP_TAG_ZERO)) != NULL) ||
+              ((ipp_attr = NULL) ||
+               (keyword = cupsGetOption("back-side-orientation",
+                                        num_options, options)) != NULL))
+      {
+       if (ipp_attr)
+         keyword = ippGetString(ipp_attr, 0, NULL);
+       if (!strcasecmp(keyword, "flipped"))
+         backside = CF_BACKSIDE_FLIPPED;
+       else if (!strncasecmp(keyword, "manual", 6))
+         backside = CF_BACKSIDE_MANUAL_TUMBLE;
+       else if (!strcasecmp(keyword, "normal"))
+         backside = CF_BACKSIDE_NORMAL;
+       else if (!strcasecmp(keyword, "rotated"))
+         backside = CF_BACKSIDE_ROTATED;
+      }
+
+      if (backside == -1)
+       backside = CF_BACKSIDE_NORMAL;
+      else if ((keyword = cupsGetOption("duplex-requires-flipped-margin",
+                                       num_options, options)) != NULL)
+      {
+       if (strcasecmp(keyword, "true") == 0)
+         backside |= 16;
+       else
+         backside |= 8;
+      }
+    }
+  }
+
+  return (backside);
+}
+
+
+const char *
+cfGetPrintRenderIntent(cf_filter_data_t *data,
+                      char *ri,
+                      int ri_len)
+{
+  const char           *val;
+  int                  num_options = 0;
+  cups_option_t        *options = NULL;
+  ipp_t                *printer_attrs = data->printer_attrs;
+  ipp_attribute_t      *ipp_attr;
+  cf_logfunc_t                 log = data->logfunc;
+  void                  *ld = data->logdata;
+  int                  i;
+
+
+  num_options = cfJoinJobOptionsAndAttrs(data, num_options, &options);
+
+  if ((val = cupsGetOption("print-rendering-intent", num_options,
+                          options)) != NULL ||
+      (val = cupsGetOption("PrintRenderingIntent", num_options,
+                          options)) != NULL ||
+      (val = cupsGetOption("RenderingIntent", num_options,
+                          options)) != NULL)
+  {
+    if (!strcasecmp(val, "absolute"))
+      snprintf(ri, ri_len, "%s", "Absolute");
+    else if (!strcasecmp(val, "auto") || !strcasecmp(val, "automatic"))
+      snprintf(ri, ri_len, "%s", "Automatic");
+    else if (!strcasecmp(val, "perceptual"))
+      snprintf(ri, ri_len, "%s", "Perceptual");
+    else if (!strcasecmp(val, "relative"))
+      snprintf(ri, ri_len, "%s", "Relative");
+    else if (!strcasecmp(val, "relative-bpc") ||
+            !strcasecmp(val, "relativebpc"))
+      snprintf(ri, ri_len, "%s", "RelativeBpc");
+    else if (!strcasecmp(val, "saturation"))
+      snprintf(ri, ri_len, "%s", "Saturation");
+  }
+
+  if ((ipp_attr = ippFindAttribute(printer_attrs,
+                                  "print-rendering-intent-supported",
+                                  IPP_TAG_ZERO)) != NULL)
+  {
+    int autoRender = 0;
+    int count;
+
+    if ((count = ippGetCount(ipp_attr)) > 0)
+    {
+      for (i = 0; i < count; i ++)
+      {
+       const char *temp = ippGetString(ipp_attr, i, NULL);
+       if (!strcasecmp(temp, "auto")) autoRender = 1;
+       if (ri[0] != '\0')
+         // User has supplied a setting
+         if (!strcasecmp(ri, temp))
+           break;
+      }
+      if (ri[0] != '\0' && i == count)
+      {
+       if (log) log(ld, CF_LOGLEVEL_DEBUG,
+                    "User specified print-rendering-intent not supported "
+                    "by printer, using default print rendering intent.");
+       ri[0] = '\0';
+      }
+      if (ri[0] == '\0')
+      {        // Either user has not supplied any setting
+       // or user supplied value is not supported by printer
+       if ((ipp_attr = ippFindAttribute(printer_attrs,
+                                        "print-rendering-intent-default",
+                                        IPP_TAG_ZERO)) != NULL)
+         snprintf(ri, ri_len, "%s", ippGetString(ipp_attr, 0, NULL));
+       else if (autoRender == 1)
+         snprintf(ri, ri_len, "%s", "auto");
+      }
+    }
+  }
+
+  cupsFreeOptions(num_options, options);
+  return (ri);
+}
+
+
+//
+// 'cfJoinJobOptionsAndAttrs()' - Function for storing job IPP attribute in
+//                                option list, together with the options
+//
+
+int                                               // O  - New number of options
+                                                  //      in new option list
+cfJoinJobOptionsAndAttrs(cf_filter_data_t* data,  // I  - Filter data
+                        int num_options,         // I  - Current mumber of
+                                                 //      options in new option
+                                                 //      list
+                        cups_option_t **options) // IO - New option lsit
+{
+  ipp_t *job_attrs = data->job_attrs;   // Job attributes
+  ipp_attribute_t *ipp_attr;            // IPP attribute
+  int i = 0;                            // Looping variable
+  char buf[2048];                       // Buffer for storing value of ipp attr
+  cups_option_t *opt;
+
+  for (i = 0, opt = data->options; i < data->num_options; i ++, opt ++)
+    num_options = cupsAddOption(opt->name, opt->value, num_options, options);
+
+  for (ipp_attr = ippFirstAttribute(job_attrs); ipp_attr;
+       ipp_attr = ippNextAttribute(job_attrs))
+  {
+    ippAttributeString(ipp_attr, buf, sizeof(buf));
+    num_options = cupsAddOption(ippGetName(ipp_attr), buf,
+                               num_options, options);
+  }
+
+  return (num_options);
+}
+
+
 #ifndef HAVE_STRLCPY
 //
 // 'strlcpy()' - Safely copy two strings.
index cd88ac976e4c0be5a31a7b189dfd6ffc0abd417f..a5f0abd19c10d569f02eaa644c8e7fb0f8c5062d 100644 (file)
@@ -30,6 +30,7 @@ extern "C" {
 
 #include <config.h>
 
+#include "filter.h"
 #include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -69,6 +70,16 @@ enum cf_driverless_support_modes_e
                             // attribute
 };
 
+// Backside orientations for duplex printing
+typedef enum cf_backside_orient_e
+{
+  CF_BACKSIDE_MANUAL_TUMBLE,
+  CF_BACKSIDE_ROTATED,
+  CF_BACKSIDE_FLIPPED,
+  CF_BACKSIDE_NORMAL
+} cf_backside_orient_t;
+
+
 // Data structure for resolution (X x Y dpi)
 typedef struct cf_res_s
 {
@@ -87,60 +98,70 @@ typedef enum cf_gen_sizes_mode_e
 // Prototypes...
 //
 
-char    *cfResolveURI(const char *raw_uri);
-char    *cfippfindBasedURIConverter(const char *uri ,int is_fax);
-int     cfCheckDriverlessSupport(const char* uri);
-ipp_t   *cfGetPrinterAttributes(const char* raw_uri,
-                               const char* const pattrs[],
-                               int pattrs_size,
-                               const char* const req_attrs[],
-                               int req_attrs_size,
-                               int debug);
-ipp_t   *cfGetPrinterAttributes2(http_t *http_printer,
-                                const char* raw_uri,
-                                const char* const pattrs[],
-                                int pattrs_size,
-                                const char* const req_attrs[],
-                                int req_attrs_size,
-                                int debug);
-ipp_t   *cfGetPrinterAttributes3(http_t *http_printer,
-                                const char* raw_uri,
-                                const char* const pattrs[],
-                                int pattrs_size,
-                                const char* const req_attrs[],
-                                int req_attrs_size,
-                                int debug,
-                                int* driverless_support);
-ipp_t   *cfGetPrinterAttributes4(const char* raw_uri,
-                                const char* const pattrs[],
-                                int pattrs_size,
-                                const char* const req_attrs[],
-                                int req_attrs_size,
-                                int debug,
-                                int isFax);
-ipp_t   *cfGetPrinterAttributes5(http_t *http_printer,
-                                const char* raw_uri,
-                                const char* const pattrs[],
-                                int pattrs_size,
-                                const char* const req_attrs[],
-                                int req_attrs_size,
-                                int debug,
-                                int* driverless_support,
-                                int resolve_uri_type);
-
-const char* cfIPPAttrEnumValForPrinter(ipp_t *printer_attrs,
-                                      ipp_t *job_attrs,
-                                      const char *attr_name);
-int cfIPPAttrIntValForPrinter(ipp_t *printer_attrs,
-                             ipp_t *job_attrs,
-                             const char *attr_name,
-                             int   *value);
-int cfIPPAttrResolutionForPrinter(ipp_t *printer_attrs, ipp_t *job_attrs,
-                                 const char *attr_name, int *xres, int *yres);
-int cfIPPReverseOutput(ipp_t *printer_attrs, ipp_t *job_attrs);
-
+char            *cfResolveURI(const char *raw_uri);
+char            *cfippfindBasedURIConverter(const char *uri ,int is_fax);
+int             cfCheckDriverlessSupport(const char* uri);
+ipp_t           *cfGetPrinterAttributes(const char* raw_uri,
+                                       const char* const pattrs[],
+                                       int pattrs_size,
+                                       const char* const req_attrs[],
+                                       int req_attrs_size,
+                                       int debug);
+ipp_t           *cfGetPrinterAttributes2(http_t *http_printer,
+                                        const char* raw_uri,
+                                        const char* const pattrs[],
+                                        int pattrs_size,
+                                        const char* const req_attrs[],
+                                        int req_attrs_size,
+                                        int debug);
+ipp_t           *cfGetPrinterAttributes3(http_t *http_printer,
+                                        const char* raw_uri,
+                                        const char* const pattrs[],
+                                        int pattrs_size,
+                                        const char* const req_attrs[],
+                                        int req_attrs_size,
+                                        int debug,
+                                        int* driverless_support);
+ipp_t           *cfGetPrinterAttributes4(const char* raw_uri,
+                                        const char* const pattrs[],
+                                        int pattrs_size,
+                                        const char* const req_attrs[],
+                                        int req_attrs_size,
+                                        int debug,
+                                        int isFax);
+ipp_t           *cfGetPrinterAttributes5(http_t *http_printer,
+                                        const char* raw_uri,
+                                        const char* const pattrs[],
+                                        int pattrs_size,
+                                        const char* const req_attrs[],
+                                        int req_attrs_size,
+                                        int debug,
+                                        int* driverless_support,
+                                        int resolve_uri_type);
+
+const char      *cfIPPAttrEnumValForPrinter(ipp_t *printer_attrs,
+                                           ipp_t *job_attrs,
+                                           const char *attr_name);
+int             cfIPPAttrIntValForPrinter(ipp_t *printer_attrs,
+                                         ipp_t *job_attrs,
+                                         const char *attr_name,
+                                         int   *value);
+int             cfIPPAttrResolutionForPrinter(ipp_t *printer_attrs,
+                                             ipp_t *job_attrs,
+                                             const char *attr_name,
+                                             int *xres, int *yres);
+int             cfIPPReverseOutput(ipp_t *printer_attrs, ipp_t *job_attrs);
+int             cfGetBackSideOrientation(cf_filter_data_t *data);
+const char      *cfGetPrintRenderIntent(cf_filter_data_t *data,
+                                       char *ri, int ri_len);
+
+int             cfJoinJobOptionsAndAttrs(cf_filter_data_t *data,
+                                        int num_options,
+                                        cups_option_t **options);
+  
 char            *cfStrFormatd(char *buf, char *bufend, double number,
                              struct lconv *loc);
+
 int             cfCompareResolutions(void *resolution_a, void *resolution_b,
                                     void *user_data);
 void            *cfCopyResolution(void *resolution, void *user_data);
index b4e14a70e54886d4e9dfc944985018cce3c1e426..10369d386f925ee9e0f2f3e2261748e5fc9bd759 100644 (file)
@@ -39,6 +39,7 @@
 #include <cups/raster.h>
 #include <cupsfilters/colormanager.h>
 #include <cupsfilters/raster.h>
+#include <cupsfilters/ipp.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <signal.h>
index 9b8d92269b6ec539029bc1eca4eeced54df8215c..5d81ceb9355676e246d7a5593dbd84b45e956ff9 100644 (file)
@@ -36,7 +36,7 @@
 #include <cups/raster.h>
 #include <cupsfilters/colormanager.h>
 #include <cupsfilters/image.h>
-#include <cupsfilters/raster.h>
+#include <cupsfilters/ipp.h>
 
 #include <arpa/inet.h>   // ntohl
 
index bd54ff27e4183e40f919d656084a8ce19cbd885d..8e5fed4c0545b01e427bc2321575391e60ffba89 100644 (file)
@@ -6,17 +6,10 @@
 //   Distribution and use rights are outlined in the file "COPYING"
 //   which should have been included with this file.
 //
-// Contents:
-//
 //   cfRasterColorSpaceString() - Return strings for CUPS color spaces
-//   cfGetBackSideOrientation() - Return backside orientation for duplex
-//                                printing
-//   cfGetPrintRenderIntent()   - Return rendering intent for a job
 //   cfRasterPrepareHeader()    - Prepare a Raster header for a job
 //   cfRasterSetColorSpace()    - Find best color space for print-color-mode
 //                                and print-quality setting
-//   cfJoinJobOptionsAndAttrs() - Join job IPP attributes and job options in
-//                                one option list
 //
 
 //
@@ -156,237 +149,6 @@ cfRasterColorSpaceString(cups_cspace_t cspace)    // I - cupsColorSpace value
 }
 
 
-//
-//  'cfGetBackSideOrientation()' - This functions returns the back
-//                                side orientation using printer
-//                                attributes.  Meaning and reason for
-//                                backside orientation: It only makes
-//                                sense if printer supports duplex,
-//                                so, if printer reports that it
-//                                supports duplex printing via
-//                                sides-supported IPP attribute, then
-//                                it also reports back-side
-//                                orientation for each PDL in PDL
-//                                specific IPP attributes. Backside
-//                                orientation is specially needed for
-//                                raster PDLs as raster PDLs are
-//                                specially made for raster printers
-//                                which do not have sufficient memory
-//                                to hold a full page bitmap(raster
-//                                page).  So they cannot build the
-//                                whole page in memory before
-//                                starting to print it. For one sided
-//                                printing it is easy to manage. The
-//                                printer's mechanism pulls the page
-//                                in on its upper edge and starts to
-//                                print, from top to bottom, after
-//                                that it ejects the page.  For
-//                                double-sided printing it does the
-//                                same for the front side, but for
-//                                the back side the mechanics of the
-//                                printer has to turn over the sheet,
-//                                and now, depending on how the sheet
-//                                is turned over it happens that the
-//                                edge arriving in the printing
-//                                mechanism is the lower edge of the
-//                                back side. And if the printer
-//                                simply prints then, the back side
-//                                is the wrong way around. The
-//                                printer reports its need via back
-//                                side orientation in such a case, so
-//                                that the client knows to send the
-//                                back side upside down for example.
-//                                In vector PDL, PDF and PostScript,
-//                                always the full page's raster image
-//                                is completely generated in the
-//                                printer before the page is started,
-//                                and therefore the printer can start
-//                                to take the pixels from the lower
-//                                edge of the raster image if needed,
-//                                so back side orientation is always
-//                                "normal" for these PDLs.  And if a
-//                                printer does not support duplex,
-//                                back side orientation is not
-//                                needed.
-//
-
-int                                   // O - Backside orientation (bit 0-2)
-                                      //     Requires flipped margin?
-                                      //     Yes: bit 4 set; No: bit 3 set
-cfGetBackSideOrientation(cf_filter_data_t *data) // I - Filter data
-{
-  ipp_t *printer_attrs = data->printer_attrs;
-  int num_options = data->num_options;
-  cups_option_t *options = data->options;
-  char *final_content_type = data->final_content_type;
-  ipp_attribute_t *ipp_attr = NULL; // IPP attribute
-  int i,                       // Looping variable
-      count;                   
-  const char *keyword;
-  int backside = -1;   // backside obtained using printer attributes
-
-
-  // also check options
-  if ((ipp_attr = ippFindAttribute(printer_attrs, "sides-supported",
-                                  IPP_TAG_ZERO)) != NULL)
-  {
-    if (ippContainsString(ipp_attr, "two-sided-long-edge"))
-    {
-      if (final_content_type &&
-         strcasestr(final_content_type, "/urf") &&
-         (ipp_attr = ippFindAttribute(printer_attrs, "urf-supported",
-                                      IPP_TAG_ZERO)) != NULL)
-      {
-       for (i = 0, count = ippGetCount(ipp_attr); i < count; i ++)
-       {
-         const char *dm = ippGetString(ipp_attr, i, NULL); // DM value
-         if (!strcasecmp(dm, "DM1"))
-         {
-           backside = CF_BACKSIDE_NORMAL;
-           break;
-         }
-         if (!strcasecmp(dm, "DM2"))
-         {
-           backside = CF_BACKSIDE_FLIPPED;
-           break;
-         }
-         if (!strcasecmp(dm, "DM3"))
-         {
-           backside = CF_BACKSIDE_ROTATED;
-           break;
-         }
-         if (!strcasecmp(dm, "DM4"))
-         {
-           backside = CF_BACKSIDE_MANUAL_TUMBLE;
-           break;
-         }
-       }
-      }
-      else if ((final_content_type &&
-               strcasestr(final_content_type, "/vnd.pwg-raster") &&
-               (ipp_attr = ippFindAttribute(printer_attrs,
-                                            "pwg-raster-document-sheet-back",
-                                            IPP_TAG_ZERO)) != NULL) ||
-              (final_content_type &&
-               strcasestr(final_content_type, "/pclm") &&
-               (ipp_attr = ippFindAttribute(printer_attrs,
-                                            "pclm-raster-back-side",
-                                            IPP_TAG_ZERO)) != NULL) ||
-              ((ipp_attr = NULL) ||
-               (keyword = cupsGetOption("back-side-orientation",
-                                        num_options, options)) != NULL))
-      {
-       if (ipp_attr)
-         keyword = ippGetString(ipp_attr, 0, NULL);
-       if (!strcasecmp(keyword, "flipped"))
-         backside = CF_BACKSIDE_FLIPPED;
-       else if (!strncasecmp(keyword, "manual", 6))
-         backside = CF_BACKSIDE_MANUAL_TUMBLE;
-       else if (!strcasecmp(keyword, "normal"))
-         backside = CF_BACKSIDE_NORMAL;
-       else if (!strcasecmp(keyword, "rotated"))
-         backside = CF_BACKSIDE_ROTATED;               
-      }
-      
-      if (backside == -1)
-       backside = CF_BACKSIDE_NORMAL;
-      else if ((keyword = cupsGetOption("duplex-requires-flipped-margin",
-                                       num_options, options)) != NULL)
-      {
-       if (strcasecmp(keyword, "true") == 0)
-         backside |= 16;
-       else
-         backside |= 8;
-      }
-    }
-  }
-
-  return (backside);
-}
-
-
-const char *
-cfGetPrintRenderIntent(cf_filter_data_t *data,
-                      char *ri,
-                      int ri_len)
-{
-  const char           *val;
-  int                  num_options = 0;
-  cups_option_t        *options = NULL;
-  ipp_t                *printer_attrs = data->printer_attrs;
-  ipp_attribute_t      *ipp_attr;
-  cf_logfunc_t                 log = data->logfunc;
-  void                  *ld = data->logdata;
-  int                  i;
-
-
-  num_options = cfJoinJobOptionsAndAttrs(data, num_options, &options);
-
-  if ((val = cupsGetOption("print-rendering-intent", num_options,
-                          options)) != NULL ||
-      (val = cupsGetOption("PrintRenderingIntent", num_options,
-                          options)) != NULL ||
-      (val = cupsGetOption("RenderingIntent", num_options,
-                          options)) != NULL)
-  {
-    if (!strcasecmp(val, "absolute"))
-      snprintf(ri, ri_len, "%s", "Absolute");
-    else if (!strcasecmp(val, "auto") || !strcasecmp(val, "automatic"))
-      snprintf(ri, ri_len, "%s", "Automatic");
-    else if (!strcasecmp(val, "perceptual"))
-      snprintf(ri, ri_len, "%s", "Perceptual");
-    else if (!strcasecmp(val, "relative"))
-      snprintf(ri, ri_len, "%s", "Relative");
-    else if (!strcasecmp(val, "relative-bpc") ||
-            !strcasecmp(val, "relativebpc"))
-      snprintf(ri, ri_len, "%s", "RelativeBpc");
-    else if (!strcasecmp(val, "saturation"))
-      snprintf(ri, ri_len, "%s", "Saturation");
-  }
-
-  if ((ipp_attr = ippFindAttribute(printer_attrs,
-                                  "print-rendering-intent-supported",
-                                  IPP_TAG_ZERO)) != NULL)
-  {
-    int autoRender = 0;
-    int count;
-
-    if ((count = ippGetCount(ipp_attr)) > 0)
-    {
-      for (i = 0; i < count; i ++)
-      {
-       const char *temp = ippGetString(ipp_attr, i, NULL);
-       if (!strcasecmp(temp, "auto")) autoRender = 1;
-       if (ri[0] != '\0')
-         // User has supplied a setting
-         if (!strcasecmp(ri, temp))
-           break;
-      }
-      if (ri[0] != '\0' && i == count)
-      {
-       if (log) log(ld, CF_LOGLEVEL_DEBUG,
-                    "User specified print-rendering-intent not supported "
-                    "by printer, using default print rendering intent.");
-       ri[0] = '\0';
-      }
-      if (ri[0] == '\0')
-      {        // Either user has not supplied any setting
-       // or user supplied value is not supported by printer
-       if ((ipp_attr = ippFindAttribute(printer_attrs,
-                                        "print-rendering-intent-default",
-                                        IPP_TAG_ZERO)) != NULL)
-         snprintf(ri, ri_len, "%s", ippGetString(ipp_attr, 0, NULL));
-       else if (autoRender == 1)
-         snprintf(ri, ri_len, "%s", "auto");
-      }
-    }
-  }
-
-  cupsFreeOptions(num_options, options);
-  return (ri);
-}
-
-
 //
 // 'cfRasterPrepareHeader() - This function creates a CUPS/PWG Raster
 //                            header for Raster output based on the
@@ -2075,37 +1837,3 @@ raster_base_header(cups_page_header2_t *h, // O - Raster header
 
   return (0);
 }
-
-
-//
-// 'cfJoinJobOptionsAndAttrs()' - Function for storing job IPP attribute in
-//                                option list, together with the options
-//
-
-int                                               // O  - New number of options
-                                                  //      in new option list
-cfJoinJobOptionsAndAttrs(cf_filter_data_t* data,  // I  - Filter data
-                        int num_options,         // I  - Current mumber of
-                                                 //      options in new option
-                                                 //      list
-                        cups_option_t **options) // IO - New option lsit
-{
-  ipp_t *job_attrs = data->job_attrs;   // Job attributes
-  ipp_attribute_t *ipp_attr;            // IPP attribute
-  int i = 0;                            // Looping variable
-  char buf[2048];                       // Buffer for storing value of ipp attr
-  cups_option_t *opt;
-
-  for (i = 0, opt = data->options; i < data->num_options; i ++, opt ++)
-    num_options = cupsAddOption(opt->name, opt->value, num_options, options);
-
-  for (ipp_attr = ippFirstAttribute(job_attrs); ipp_attr;
-       ipp_attr = ippNextAttribute(job_attrs))
-  {
-    ippAttributeString(ipp_attr, buf, sizeof(buf));
-    num_options = cupsAddOption(ippGetName(ipp_attr), buf,
-                               num_options, options);
-  }
-
-  return (num_options);
-}
index 78717b3ebd9c5d5bde41790d2acb6a486d587004..80b4eb4ee23541c32b6099b31433cc2861a8a616 100644 (file)
@@ -14,6 +14,7 @@
 extern "C" {
 #  endif // __cplusplus
 
+
 //
 // Include necessary headers...
 //
@@ -35,24 +36,11 @@ extern "C" {
 #  include <cups/raster.h>
 
 
-//
-// Types
-//
-
-typedef enum cf_backside_orient_e
-{
-  CF_BACKSIDE_MANUAL_TUMBLE,
-  CF_BACKSIDE_ROTATED,
-  CF_BACKSIDE_FLIPPED,
-  CF_BACKSIDE_NORMAL
-} cf_backside_orient_t;
-
-
 //
 // Prototypes...
 //
 
-extern const char *     cfRasterColorSpaceString(cups_cspace_t cspace);
+extern const char       *cfRasterColorSpaceString(cups_cspace_t cspace);
 extern int              cfRasterPrepareHeader(cups_page_header2_t *h,
                                              cf_filter_data_t *data,
                                              cf_filter_out_format_t
@@ -66,12 +54,6 @@ extern int              cfRasterSetColorSpace(cups_page_header2_t *h,
                                              const char *color_mode,
                                              cups_cspace_t *cspace,
                                              int *high_depth);
-extern int             cfJoinJobOptionsAndAttrs(cf_filter_data_t *data,
-                                                int num_options,
-                                                cups_option_t **options);
-extern int             cfGetBackSideOrientation(cf_filter_data_t *data);
-extern const char      *cfGetPrintRenderIntent(cf_filter_data_t *data,
-                                               char *ri, int ri_len);
 
 #  ifdef __cplusplus
 }
index e7e9321da4f40c6caa45e56497c0968c754cca47..08f67bf6fbaac3b75673d2753a3d44107e22934e 100644 (file)
@@ -31,6 +31,7 @@
 #include <ctype.h>
 #include <cupsfilters/filter.h>
 #include <cupsfilters/raster.h>
+#include <cupsfilters/ipp.h>
 #include <cupsfilters/pdf.h>
 #include <cupsfilters/image-private.h>
 #include "ppd.h"
@@ -286,7 +287,7 @@ ppdFilterPDFToPS(int inputfd,         /* I - File descriptor input stream */
                 mres, res,
                 maxres = CUPS_PDFTOPS_MAX_RESOLUTION,
                                         /* Maximum image rendering resolution */
-                numvalues;              /* Number of values actually read */
+                numvalues = 0;          /* Number of values actually read */
   ppd_choice_t  *choice;
   ppd_attr_t    *attr;
   cups_page_header2_t header;