Partial fix for 687657 Text in transparency mask yields rangecheck discardtransparencymask error
"Dan Coby" <[email protected]> Fri, 10 Sep 2004 00:24:24 -0700
| Newsgroups | gmane.comp.printing.ghostscript.patches |
|---|---|
| Message-ID | <[email protected]> |
Partial fix for 687657 Text in transparency mask yields rangecheck in
discardtransparencymask.
DETAILS:
Three problems have been found with this file.
The rangecheck is actually a secondary effect. The actual problem
was a typecheck in setrgbcolor. However that error occurred inside
a stopped context.
1) The file has a mask group. This group specifies a color space (CS).
The previous code set the current color space to the given value.
However the FillColorSpace and StrokeColorSpace were not set. As a
result, a DeviceRGB color space was being used instead of the specified
DeviceGray color space. This resulted in a mismatch in the number
of operands when the color as set (1 versus 3). The fix consists of
setting both StrokeColorSpace and FillColorSpace when a mask group
contains a CS value.
2) The file uses scn for setting color values for a DeviceGray color
space. FillColor and StrokeColor can contain wither a single numeric
value (which is common but not required for DeviceGray) or an array
of values for all other color spaces. The scn and SCN operators were
always assuming that these values always contained arrays. The fix
consists of checking for the non array cases in the operators.
3) The appearance produced by Ghostscript with the test file does not
match Adobe. A solid magenta rectangle is produced by Ghostscript.
Adobe shows magenta text. This problem is NOT fixed by this patch.
Note: If the test file is opened with Illustrator CS and then saved,
Ghostscript does produced the same appearance as Adobe for the saved
file. The reason for the differences are not currently known.
Dan
Index: lib/pdf_draw.ps
===================================================================
RCS file: /cvs/ghostscript/gs/lib/pdf_draw.ps,v
retrieving revision 1.84
diff -u -r1.84 pdf_draw.ps
--- lib/pdf_draw.ps 31 Aug 2004 22:07:39 -0000 1.84
+++ lib/pdf_draw.ps 10 Sep 2004 04:23:25 -0000
@@ -369,7 +369,7 @@
dup /BC knownoget {
gsave
1 index /G oget /Group oget /CS knownoget {
- csresolve setgcolorspace
+ csresolve dup setgcolorspace csput
} if
aload pop setcolor [ currentgray ]
grestore
@@ -391,7 +391,7 @@
gsave PDFfile fileposition 4 1 roll
% We have to select the group's color space so that the
% background color will be interpreted correctly.
- dup /Group oget /CS knownoget { csresolve setgcolorspace } if
+ dup /Group oget /CS knownoget { csresolve dup setgcolorspace csput } if
exch dup /BBox get aload pop .begintransparencymask {
dup /Resources knownoget { oforce } { 0 dict } ifelse
exch false resolvestream
Index: lib/pdf_ops.ps
===================================================================
RCS file: /cvs/ghostscript/gs/lib/pdf_ops.ps,v
retrieving revision 1.34
diff -u -r1.34 pdf_ops.ps
--- lib/pdf_ops.ps 17 Aug 2004 17:53:13 -0000 1.34
+++ lib/pdf_ops.ps 10 Sep 2004 04:23:28 -0000
@@ -143,6 +143,9 @@
/scput % <color> <colorspace> scput -
{ /StrokeColorSpace gput /StrokeColor gput
} bdef
+/csput % <colorspace> csput -
+ { csset 2 copy fcput scput
+ } bdef
/csdevgray [/DeviceGray] readonly def
/csdevrgb [/DeviceRGB] readonly def
@@ -201,14 +204,20 @@
currentdict /FillColor .knownget {
astore pop
} {
- /FillColor load length array astore cvx /FillColor gput
+ /FillColor load
+ % FillColor may contain either a single value or an array.
+ dup type /arraytype eq { length }{ pop 1 } ifelse
+ array astore cvx /FillColor gput
} ifelse
} bdef
/SC* {
currentdict /StrokeColor .knownget {
astore pop
} {
- /StrokeColor load length array astore cvx /StrokeColor gput
+ /StrokeColor load
+ % StrokeColor may contain either a single value or an array.
+ dup type /arraytype eq { length }{ pop 1 } ifelse
+ array astore cvx /StrokeColor gput
} ifelse
} bdef