]> git.ipfire.org Git - thirdparty/cups-filters.git/commitdiff
libcupsfilters: In generated PPDs add a grayscale mode if only color available
authorTill Kamppeter <till.kamppeter@gmail.com>
Tue, 1 Dec 2020 23:15:04 +0000 (00:15 +0100)
committerTill Kamppeter <till.kamppeter@gmail.com>
Wed, 2 Dec 2020 11:13:00 +0000 (12:13 +0100)
(cherry picked from commit 63b4b1ad9d82399b74254df5b65123831896257c)

NEWS
cupsfilters/ppdgenerator.c

diff --git a/NEWS b/NEWS
index 8687cac0f7c81ab9142849cba2b5d3d51b47f7eb..c1ebafe6d9b01a92978d4bce0953e4e11bc67f49 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,9 @@ NEWS - OpenPrinting CUPS Filters v1.28.5 - 2020-10-13
 
 CHANGES IN V1.28.6
 
+       - libcupsfilters: In generated PPDs add a grayscale mode if
+         there are only color printing modes (from OpenPrinting
+         CUPS).
        - libcupsfilters: In generated PPDs add an "OutputBin" option
          also if it has only one choice (OpenPrinting CUPS pull
          request #18).
index 41f52ba57e1705c4031c7d4fe1d575b2800e55ea..017945002bba51ceae256d983aa4d9777d64344e 100644 (file)
@@ -2870,6 +2870,18 @@ ppdCreateFromIPP2(char         *buffer,          /* I - Filename buffer */
                        _cupsLangString(lang, _("Color"))));
 
        default_color = "RGB";
+
+       if (ippGetCount(attr) == 1 ||
+           (!ippContainsString(attr, "sgray_8") &&
+            !ippContainsString(attr, "black_1") &&
+            !ippContainsString(attr, "black_8"))) {
+         human_readable2 = lookup_choice("monochrome", "print-color-mode",
+                                         opt_strings_catalog,
+                                         printer_opt_strings_catalog);
+         cupsFilePrintf(fp, "*ColorModel Gray/%s: \"<</cupsColorSpace 18/cupsBitsPerColor 8/cupsColorOrder 0/cupsCompression 0>>setpagedevice\"\n",
+                        (human_readable2 ? human_readable2 :
+                         _cupsLangString(lang, _("Grayscale"))));
+       }
       } else if (!strcasecmp(keyword, "adobe-rgb_16") ||
                 !strncmp(keyword, "ADOBERGB48", 10) ||
                 !strncmp(keyword, "ADOBERGB24-48", 13)) {