]> git.ipfire.org Git - thirdparty/cups-filters.git/commitdiff
libcupsfilters: Fix duplicate ColorModel entries in generated PPD files
authorTill Kamppeter <till.kamppeter@gmail.com>
Thu, 3 Dec 2020 13:51:18 +0000 (14:51 +0100)
committerTill Kamppeter <till.kamppeter@gmail.com>
Thu, 3 Dec 2020 13:54:24 +0000 (14:54 +0100)
(cherry picked from commit a9389fa4a51b3c7fc45d29012d9b0b29a1b1794e)

cupsfilters/ppdgenerator.c

index 017945002bba51ceae256d983aa4d9777d64344e..1368ee6d47a395648e48f41366651477ad7f9172 100644 (file)
@@ -2769,6 +2769,8 @@ ppdCreateFromIPP2(char         *buffer,          /* I - Filename buffer */
       have_bi_level = 0,
       have_mono = 0;
 
+    cupsFilePrintf(fp, "*%% ColorModel from %s\n", ippGetName(attr));
+
     for (i = 0, count = ippGetCount(attr); i < count; i ++) {
       keyword = ippGetString(attr, i, NULL); /* Keyword for color/bit depth */
 
@@ -2871,10 +2873,13 @@ ppdCreateFromIPP2(char         *buffer,          /* I - Filename buffer */
 
        default_color = "RGB";
 
-       if (ippGetCount(attr) == 1 ||
-           (!ippContainsString(attr, "sgray_8") &&
-            !ippContainsString(attr, "black_1") &&
-            !ippContainsString(attr, "black_8"))) {
+       /* Apparently some printers only advertise color support, so make sure
+           we also do grayscale for these printers... */
+       if (!ippContainsString(attr, "sgray_8") &&
+           !ippContainsString(attr, "black_1") &&
+           !ippContainsString(attr, "black_8") &&
+           !ippContainsString(attr, "W8") &&
+           !ippContainsString(attr, "W8-16")) {
          human_readable2 = lookup_choice("monochrome", "print-color-mode",
                                          opt_strings_catalog,
                                          printer_opt_strings_catalog);