]> git.ipfire.org Git - thirdparty/cups-filters.git/commitdiff
libcupsfilters: Clean up "*cupsFilter2: ..." line in generated PPDs
authorTill Kamppeter <till.kamppeter@gmail.com>
Thu, 3 Feb 2022 23:48:25 +0000 (20:48 -0300)
committerTill Kamppeter <till.kamppeter@gmail.com>
Thu, 3 Feb 2022 23:48:25 +0000 (20:48 -0300)
NEWS
cupsfilters/ppdgenerator.c

diff --git a/NEWS b/NEWS
index 53b5bf1f3af7744924d7cf311e46c0a76d448c49..55e7d828b3d84c56fda25e2fa6ae801fe3cae5b1 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,11 @@ NEWS - OpenPrinting CUPS Filters v1.28.11 - 2022-01-15
 
 CHANGES IN V1.28.12
 
+       - libcupsfilters: In the PPD generator for the driverless
+         utility and cups-browsed add "*cupsFilter2: ..." lines for
+         all supported driverless data formats (PDF, Apple/PWG
+         Raster, PCLm), and add lines for legacy data formats (PCL,
+         PostScript) only if no driverless formats available.
        - libcupsfilters: Always use encryption for ipps. RFC7472
          requires that 'ipps' must be used over HTTPS, but the
          driverless utility does not enforce encryption (Pull request
index 18652bb4291ffbd5c7d6ce58d83fd15b2980592d..23d519d1b837189c85a26aee52a88f98aa23fab9 100644 (file)
@@ -2011,7 +2011,7 @@ ppdCreateFromIPP2(char         *buffer,          /* I - Filename buffer */
     }
   }
 #endif
-  if (is_apple == 0 && cupsArrayFind(pdl_list, "image/pwg-raster")) {
+  if (cupsArrayFind(pdl_list, "image/pwg-raster")) {
     if ((attr = ippFindAttribute(response,
                                 "pwg-raster-document-resolution-supported",
                                 IPP_TAG_RESOLUTION)) != NULL) {
@@ -2047,39 +2047,42 @@ ppdCreateFromIPP2(char         *buffer,          /* I - Filename buffer */
     }
   }
 #endif
-  if (cupsArrayFind(pdl_list, "application/vnd.hp-pclxl")) {
-    /* Check whether the gstopxl filter is installed,
-       otherwise ignore the PCL-XL support of the printer */
-    if ((cups_serverbin = getenv("CUPS_SERVERBIN")) == NULL)
-      cups_serverbin = CUPS_SERVERBIN;
-    snprintf(filter_path, sizeof(filter_path), "%s/filter/gstopxl",
-            cups_serverbin);
-    if (access(filter_path, X_OK) == 0) {
+  /* Legacy formats only if we have no driverless format */
+  if (!is_pdf && !is_apple && !is_pwg && !is_pclm) {
+    if (cupsArrayFind(pdl_list, "application/vnd.hp-pclxl")) {
+      /* Check whether the gstopxl filter is installed,
+        otherwise ignore the PCL-XL support of the printer */
+      if ((cups_serverbin = getenv("CUPS_SERVERBIN")) == NULL)
+       cups_serverbin = CUPS_SERVERBIN;
+      snprintf(filter_path, sizeof(filter_path), "%s/filter/gstopxl",
+              cups_serverbin);
+      if (access(filter_path, X_OK) == 0) {
+       /* We put a high cost factor here as if a printer supports also
+          another format, like PWG or Apple Raster, we prefer it, as some
+          PCL-XL printers have bugs in their PCL-XL interpreters */
+       cupsFilePrintf(fp, "*cupsFilter2: \"application/vnd.cups-pdf application/vnd.hp-pclxl 400 gstopxl\"\n");
+       if (formatfound == 0) manual_copies = 1;
+       formatfound = 1;
+      }
+    }
+    if (cupsArrayFind(pdl_list, "application/postscript")) {
       /* We put a high cost factor here as if a printer supports also
-        another format, like PWG or Apple Raster, we prefer it, as some
-        PCL-XL printers have bugs in their PCL-XL interpreters */
-      cupsFilePrintf(fp, "*cupsFilter2: \"application/vnd.cups-pdf application/vnd.hp-pclxl 400 gstopxl\"\n");
+        another format, like PWG or Apple Raster, we prefer it, as many
+        PostScript printers have bugs in their PostScript interpreters */
+      cupsFilePuts(fp, "*cupsFilter2: \"application/vnd.cups-postscript application/postscript 600 -\"\n");
+      if (formatfound == 0) manual_copies = 0;
+      formatfound = 1;
+    }
+    if (cupsArrayFind(pdl_list, "application/vnd.hp-pcl")) {
+      /* We put a high cost factor here as if a printer supports also
+        another format, like PWG or Apple Raster, we prefer it, as there
+        are some printers, like HP inkjets which report to accept PCL
+        but do not support PCL 5c/e or PCL-XL */
+      cupsFilePrintf(fp, "*cupsFilter2: \"application/vnd.cups-raster application/vnd.hp-pcl 800 rastertopclx\"\n");
       if (formatfound == 0) manual_copies = 1;
       formatfound = 1;
     }
   }
-  if (cupsArrayFind(pdl_list, "application/postscript")) {
-    /* We put a high cost factor here as if a printer supports also
-       another format, like PWG or Apple Raster, we prefer it, as many
-       PostScript printers have bugs in their PostScript interpreters */
-    cupsFilePuts(fp, "*cupsFilter2: \"application/vnd.cups-postscript application/postscript 600 -\"\n");
-    if (formatfound == 0) manual_copies = 0;
-    formatfound = 1;
-  }
-  if (cupsArrayFind(pdl_list, "application/vnd.hp-pcl")) {
-    /* We put a high cost factor here as if a printer supports also
-       another format, like PWG or Apple Raster, we prefer it, as there
-       are some printers, like HP inkjets which report to accept PCL
-       but do not support PCL 5c/e or PCL-XL */
-    cupsFilePrintf(fp, "*cupsFilter2: \"application/vnd.cups-raster application/vnd.hp-pcl 800 rastertopclx\"\n");
-    if (formatfound == 0) manual_copies = 1;
-    formatfound = 1;
-  }
   if (cupsArrayFind(pdl_list, "image/jpeg"))
     cupsFilePuts(fp, "*cupsFilter2: \"image/jpeg image/jpeg 0 -\"\n");
   if (cupsArrayFind(pdl_list, "image/png"))