Repository navigation
ppd-cache.c: Map FastGray to bi-level when the printer supports it - #106
Merged
Merged
Conversation
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
This was referenced Nov 13, 2026
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #91.
ppdConvertOptions()turns the ColorModel choicesGray,FastGrayandDeviceGrayall intoprint-color-mode=monochrome.FastGrayis the 1-bit mode thatppdCreatePPDFromIPP2()generates forbi-level, so a job withColorModel=FastGray, or a PPD that defaults to it, never asks for bi-level, even when the printer lists it inprint-color-mode-supported.Now
FastGraybecomesbi-levelwhen the printer supports it, and staysmonochromeotherwise.GrayandDeviceGrayare unchanged.Checked with a small program calling
ppdConvertOptions():I added the same four cases to
test_ppd_cache(Group 11). Two of them fail without the change, andmake checkpasses with it.This doesn't cover the case @ValdikSS mentioned, a printer with only
black_1that listsmonochromebut notbi-level. That one still sendsmonochrome, and as he said it probably belongs in libcupsfilters (OpenPrinting/libcupsfilters#298).