Skip to content

ppd-cache.c: Map FastGray to bi-level when the printer supports it - #106

Merged
tillkamppeter merged 2 commits into
OpenPrinting:masterfrom
DSingh0304:fastgray-bi-level
Nov 14, 2026
Merged

tillkamppeter merged 2 commits into
OpenPrinting:masterfrom
DSingh0304:fastgray-bi-level

Conversation

@DSingh0304

Copy link
Copy Markdown
Contributor

Fixes #91.

ppdConvertOptions() turns the ColorModel choices Gray, FastGray and DeviceGray all into print-color-mode=monochrome. FastGray is the 1-bit mode that ppdCreatePPDFromIPP2() generates for bi-level, so a job with ColorModel=FastGray, or a PPD that defaults to it, never asks for bi-level, even when the printer lists it in print-color-mode-supported.

Now FastGray becomes bi-level when the printer supports it, and stays monochrome otherwise. Gray and DeviceGray are unchanged.

Checked with a small program calling ppdConvertOptions():

                                          before       after
ColorModel=FastGray, bi-level supported   monochrome   bi-level
ColorModel=FastGray, no bi-level          monochrome   monochrome
PPD default FastGray, bi-level supported  monochrome   bi-level
ColorModel=Gray, bi-level supported       monochrome   monochrome

I added the same four cases to test_ppd_cache (Group 11). Two of them fail without the change, and make check passes with it.

This doesn't cover the case @ValdikSS mentioned, a printer with only black_1 that lists monochrome but not bi-level. That one still sends monochrome, and as he said it probably belongs in libcupsfilters (OpenPrinting/libcupsfilters#298).

ppdConvertOptions() turned the ColorModel choices Gray, FastGray and
DeviceGray all into print-color-mode=monochrome.  FastGray is the 1-bit
mode which ppdCreatePPDFromIPP2() generates for "bi-level", so a job
with ColorModel=FastGray (or a PPD defaulting to it) never requested
bi-level, even when the printer lists it in print-color-mode-supported.

Send "bi-level" for FastGray when the printer supports it and keep
"monochrome" otherwise.  Gray and DeviceGray are unchanged.

Add ppdConvertOptions() checks for this to test_ppd_cache.

Fixes OpenPrinting#91
@DSingh0304

Copy link
Copy Markdown
Contributor Author

Hi @tillkamppeter This is my first PR to libppd, so the CI workflows are waiting for approval. Could you approve them when you get a chance? Thanks!

Use sizeof() for the print-color-mode-supported value counts instead of
hardcoding them, and describe the ColorModel choices together with the
other options of the test PPD.
@tillkamppeter
tillkamppeter merged commit b28b7c2 into OpenPrinting:master Nov 14, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

libppd remaps print-color-mode=bi-level, no 1-bit PWG output possible

2 participants