Skip to content

Map print-color-mode=monochrome for PPDs with ColorModel "Grayscale" - #1816

Closed
rogercrocha wants to merge 1 commit into
OpenPrinting:masterfrom
rogercrocha:grayscale-preset
Closed

rogercrocha wants to merge 1 commit into
OpenPrinting:masterfrom
rogercrocha:grayscale-preset

Conversation

@rogercrocha

Copy link
Copy Markdown

Fixes OpenPrinting/cups-filters#801

When a PPD has no *APPrinterPreset, _ppdCacheCreateWithPPD() builds the grayscale presets from a short list of known option/choice pairs. Foomatic PPDs (the pxlcolor/pxldpl drivers and several hundred color PPDs shipped in foomatic-db) name the gray choice of ColorModel Grayscale, which is not in the list, so print-color-mode=monochrome is advertised but ignored and jobs print in color.

This adds ColorModel=Grayscale to the list, right after ColorModel=Gray, using the same mechanism as the existing entries. No other behavior changes.

Tested on master with a small program calling _ppdCacheCreateWithPPD() on the generated Brother-HL-4050CDN-pxlcolor PPD:

  • before: no monochrome presets
  • after: monochrome/normal = ColorModel=Grayscale

The same mapping, done with *APPrinterPreset on CUPS 2.4.10, makes the job print in grayscale (foomatic-rip runs Ghostscript with -sDEVICE=pxlmono instead of pxlcolor).

No cache version bump is included: _PPD_CACHE_VERSION on master is already newer than in 2.4.x, so existing cache files are regenerated on upgrade. If you want this in 2.4.x too, the backport would need a bump there.

AI disclosure: this change and its description were prepared with the help of AI (Claude, by Anthropic). The bug was reproduced on my own setup and the change was tested as described above.

🤖 Generated with Claude Code

https://claude.ai/code/session_013UYJc7DdqftdvopskQ2BoK

Foomatic PPDs name the gray choice of ColorModel "Grayscale". It was not in the list of option/choice pairs used to auto-create grayscale presets when a PPD has no APPrinterPreset, so print-color-mode=monochrome was advertised but ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013UYJc7DdqftdvopskQ2BoK
@michaelrsweet

Copy link
Copy Markdown
Member

Closing as won't fix - Foomatic driver needs to use the keywords that were defined 37 years ago...

Also, in the future if you have an issue with a fix already, please just file a PR since a bug + a PR is double the work for everyone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wontfix This will not be worked on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

print-color-mode=monochrome is ignored for PPDs whose ColorModel gray choice is "Grayscale" (Foomatic)

2 participants