]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
In auto-generated PPDs do not set RGB default on mono printers
authorTill Kamppeter <till.kamppeter@gmail.com>
Wed, 15 Feb 2023 21:01:05 +0000 (22:01 +0100)
committerTill Kamppeter <till.kamppeter@gmail.com>
Wed, 15 Feb 2023 21:01:05 +0000 (22:01 +0100)
When a PPD for a driverless printer is generated by the
_ppdCreateFromIPP2() function and the get-printer-attributes IPP
response gives "print-color-mode-default=auto" the PPD's default
setting for "ColorModel" is always "RGB", even on monochrome printers,
which makes printing fail on most devices.

Now we ignore the "print-color-mode-default" if set to "auto" and
proceed as if no default was given, finding the default by selecting
the most desirable of the existing "ColorModel" choices.

cups/ppd-cache.c

index 3c53f510dc4c7d706b1eadef2ef1772f5d738a34..2489ee313c97387f5161857b6b14dde907883908 100644 (file)
@@ -4129,7 +4129,8 @@ _ppdCreateFromIPP2(
     int wrote_color = 0;
     const char *default_color = NULL;  /* Default */
 
-    if ((keyword = ippGetString(defattr, 0, NULL)) != NULL)
+    if ((keyword = ippGetString(defattr, 0, NULL)) != NULL &&
+       strcmp(keyword, "auto"))
     {
       if (!strcmp(keyword, "bi-level"))
         default_color = "FastGray";