Repository navigation
Conversation
Keep the monochrome job intent while passing the sole supported PWG encoding to the raster filter. Derive the constraint from the generated ColorModel choices so it also applies to existing PPDs after the cache is rebuilt.
michaelrsweet
left a comment
There was a problem hiding this comment.
This is not ready for merging.
Please do not add new, unprefixed PPD keywords. Even if we wanted a "PWG black" keyword (we don't), it would need a "cups" vendor prefix.
AirPrint support (URF/Apple Raster, urf-supported) is far more reliable than IPP Everywhere in this case. If a printer only supports IPP Everywhere and the black_1 raster type, then the corresponding ColorModel PS code for the Gray choice needs to set the corresponding cupsColorSpace value that will go in the PWG Raster header. And that will tell the rasterizer filter which color space to use for grayscale (not just the name).
Printers that only support raster data will only ever use the raster path. If the printer supports both raster and PDF, there is a cupsd_job_t member that remembers whether we need to print a job as raster - the presence of PWG Raster support for the black_1 type is not an indicator that all jobs must be printed as B&W raster.
| { | ||
| pc->product = strdup(value); | ||
| } | ||
| else if (!_cups_strcasecmp(line, "PWGBlackOnly")) |
| * Product, cupsFilter, cupsFilter2, and cupsPreFilter... | ||
| */ | ||
|
|
||
| if (pc->pwg_black_only) |
| defattr = ippFindAttribute(supported, "output-mode-default", IPP_TAG_KEYWORD); | ||
|
|
||
| if ((attr = ippFindAttribute(supported, "urf-supported", IPP_TAG_KEYWORD)) == NULL) | ||
| if (is_pwg) |
There was a problem hiding this comment.
There is fairly good experience that AirPrint (and URF/Apple Raster) is a more reliable target than IPP Everywhere since many early IPP Everywhere printers incorrectly implemented PWG Raster support.
| } | ||
| } | ||
|
|
||
| if (black_only) |
There was a problem hiding this comment.
If the printer only supports black_1 then that is the cupsColorSpace that should be chosen for the "Gray" ColorSpace. If both sgray_8 and black_1 are supported then you'll have "Gray" mapped to sgray_8 and "FastGray" mapped to black_1.
| " com.apple.print.preset.output-mode monochrome\"\n" | ||
| "*End\n"); | ||
| cupsFilePuts(fp, | ||
| "*End\n", black_only ? "FastGray" : "Gray"); |
There was a problem hiding this comment.
Ditto. Don't base the default color space on the presence of black_1.
| char *product; /* Product value */ | ||
| cups_array_t *filters, /* cupsFilter/cupsFilter2 values */ | ||
| *prefilters; /* cupsPreFilter values */ | ||
| bool pwg_black_only; /* Only PWG ColorModel is one-bit black */ |
| */ | ||
|
|
||
| static int do_ppd_tests(const char *filename, int num_options, cups_option_t *options); | ||
| static int do_pwg_black_tests(void); |
There was a problem hiding this comment.
Please don't add more unit tests for PPD files. This is legacy, end-of-life code...
| static void finalize_job(cupsd_job_t *job, int set_job_state); | ||
| static void free_job_history(cupsd_job_t *job); | ||
| static char *get_options(cupsd_job_t *job, int banner_page, char *copies, | ||
| static char *get_options(cupsd_job_t *job, int banner_page, int pwg_raster, char *copies, |
A driverless queue can send 8-bit grayscale PWG Raster to a printer that lists only
black_1inpwg-raster-document-type-supported. This is reproducible with an ordinary PDF job and cups-filters 1.28.17. The generated B&W preset selectsGrayeven though the only PPD choice isFastGray. Correcting that preset alone still produces 8-bit output because the filter givesprint-color-mode=monochromeprecedence overColorModel.Keep the job's color mode and pass
pwg-raster-document-type=black_1to the filters when the final format is PWG Raster and the driverless PPD offers only packed black. The PPD cache records this constraint and can derive it from a previously generated PPD. New PPDs use the selected PWG format's color capabilities and reference the available black choice in the default and B&W presets.Reproduction
image/pwg-rasteras the PDF job's only usable output format, withpwg-raster-document-type-supported=black_1and a correctly typedpwg-raster-document-resolution-supported.lpadmin -p repro -E -v ipp://PRINTER/ipp/print -m everywhere, then submitlp -d repro example.pdfwith the queue defaults.9e5f4e2bit reports 8 bits per pixel and color space 18. With this change it reports 1 bit per pixel and color space 3. Adjacent builds of 98ac865 and its parent traced the change in default behavior to that commit.Verification
cups/testppdfor generated defaults, B&W presets, and PPD cache round trips for black-only and mixed-depth printers.make testsuite passed on Debian 13.7 (GnuTLS) and macOS (OpenSSL), including the scheduler restart and job history tests.