summaryrefslogtreecommitdiff
path: root/net-print/libcupsfilters/files/libcupsfilters-2.0.0-raster-gray.patch
blob: e1648c041e97551e804717b0bea01f055eaafcce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
https://bugs.gentoo.org/927137
https://github.com/OpenPrinting/cups-filters/issues/578
https://github.com/OpenPrinting/libcupsfilters/commit/78cc6758d98c31397c8addefaa3dfd8746331b72

From 78cc6758d98c31397c8addefaa3dfd8746331b72 Mon Sep 17 00:00:00 2001
From: zdohnal <zdohnal@redhat.com>
Date: Thu, 7 Mar 2024 18:27:06 +0100
Subject: [PATCH] raster.c: Always use sRGB/sGray if driver is PWG/URF and
 RGB/Gray is requested (#51)

Some driverless printers (EPSON L3160 in Fedora report) stopped working
after commit c6175a2 if `ColorModel=RGB` is passed as option. A
different CUPS color space is assigned with the fix - CUPS_CSPACE_RGB,
which results in no ICC profile being assigned into Ghostscript command
line.

Probably we can try other .icc profiles with CUPS_CSPACE_RGB (srgb.icc
does not work with RGB color space), but I tested with reporter that
using sRGB space + srgb.icc works for the printer - so the patch is to
use sRGB if the driver is URF/PWG.

Same logic applied for grayscale printing, if Gray is requested, sGray is
used for URF/PWG.
---
 cupsfilters/raster.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cupsfilters/raster.c b/cupsfilters/raster.c
index e9a8ad1f..7b62b922 100644
--- a/cupsfilters/raster.c
+++ b/cupsfilters/raster.c
@@ -1550,7 +1550,7 @@ raster_base_header(cups_page_header_t *h,  // O - Raster header
     {
       if (*(val + 4) == '_' || *(val + 4) == '-')
 	ptr = val + 5;
-      colorspace = 18;
+      colorspace = pwg_raster ? 18 : 3;
       numcolors = 1;
     }
     else if (is_color && !strncasecmp(val, "Srgb", 4))
@@ -1571,7 +1571,7 @@ raster_base_header(cups_page_header_t *h,  // O - Raster header
     {
       if (*(val + 3) == '_' || *(val + 3) == '-')
 	ptr = val + 4;
-      colorspace = 1;
+      colorspace = pwg_raster ? 19 : 1;
       numcolors = 3;
     }
     else if (!strcasecmp(val, "auto"))