[gs-cvs] rev 8249 - in trunk/gs: lib src
alexcher at ghostscript.com
alexcher at ghostscript.com
Sun Sep 23 20:52:20 PDT 2007
Author: alexcher
Date: 2007-09-23 20:52:18 -0700 (Sun, 23 Sep 2007)
New Revision: 8249
Modified:
trunk/gs/lib/pdf_draw.ps
trunk/gs/src/int.mak
trunk/gs/src/zchar.c
Log:
Ignore color operations in uncolored type 3 font in PDF files for
compatibility with Acrobat Reader 6 and higher.
Bug 689302, customer 870.
DIFFERENCES:
None. The performance penalty for the extra checking is below 0.1% on
all PDF files from the regression suite with nullpage device.
Modified: trunk/gs/lib/pdf_draw.ps
===================================================================
--- trunk/gs/lib/pdf_draw.ps 2007-09-23 21:41:51 UTC (rev 8248)
+++ trunk/gs/lib/pdf_draw.ps 2007-09-24 03:52:18 UTC (rev 8249)
@@ -787,22 +787,93 @@
PDFDEBUG { pdfdict /PDFSTEPcount .knownget { 1 le } { true } ifelse { (%Pattern: ) print dup === flush } if } if
} bdef
+/ignore_color_op ( **** Warning: Ignoring a color operation in a cached context.\n) readonly def
+
drawopdict begin
- /g { /DeviceGray cssubst { cs sc1 } { g } ifelse } bdef
- /rg { /DeviceRGB cssubst { cs sc* } { rg } ifelse } bdef
- /k { k } bdef
- /cs { csresolve cs } bdef
- /sc { scresolve { sc* } { sc1 } ifelse } bdef
+ /g { .incachedevice { % Bug 689302
+ pop //ignore_color_op pdfformaterror
+ } {
+ /DeviceGray cssubst { cs sc1 } { g } ifelse
+ } ifelse
+ } bdef
+
+ /rg { .incachedevice {
+ pop pop pop //ignore_color_op pdfformaterror
+ } {
+ /DeviceRGB cssubst { cs sc* } { rg } ifelse
+ } ifelse
+ } bdef
+
+ /k { .incachedevice {
+ pop pop pop pop //ignore_color_op pdfformaterror
+ } {
+ k
+ } ifelse
+ } bdef
+
+ /cs { .incachedevice {
+ pop //ignore_color_op pdfformaterror
+ } {
+ csresolve cs
+ } ifelse
+ } bdef
+
+ /sc { .incachedevice {
+ .pdfcount { pop } repeat //ignore_color_op pdfformaterror
+ } {
+ scresolve { sc* } { sc1 } ifelse
+ } ifelse
+ } bdef
+
/scn /sc load def
- /G { /DeviceGray cssubst { CS SC1 } { G } ifelse } bdef
- /RG { /DeviceRGB cssubst { CS SC* } { RG } ifelse } bdef
- /K { K } bdef
- /CS { csresolve CS } bdef
- /ri { ri } bdef
- /SC { scresolve { SC* } { SC1 } ifelse } bdef
+
+ /G { .incachedevice {
+ pop //ignore_color_op pdfformaterror
+ } {
+ /DeviceGray cssubst { CS SC1 } { G } ifelse
+ } ifelse
+ } bdef
+
+ /RG { .incachedevice {
+ pop pop pop //ignore_color_op pdfformaterror
+ } {
+ /DeviceRGB cssubst { CS SC* } { RG } ifelse
+ } ifelse
+ } bdef
+
+ /K { .incachedevice {
+ pop pop pop pop //ignore_color_op pdfformaterror
+ } {
+ K
+ } ifelse
+ } bdef
+
+ /CS { .incachedevice {
+ pop //ignore_color_op pdfformaterror
+ } {
+ csresolve CS
+ } ifelse
+ } bdef
+
+ /ri { .incachedevice {
+ pop //ignore_color_op pdfformaterror
+ } {
+ ri
+ } ifelse
+ } bdef
+
+ /SC { .incachedevice {
+ .pdfcount { pop } repeat //ignore_color_op pdfformaterror
+ } {
+ scresolve { SC* } { SC1 } ifelse
+ } ifelse
+ } bdef
+
/SCN /SC load def
end
+currentdict /ignore_color_op undef
+
% ---------------- Paths ---------------- %
drawopdict begin
Modified: trunk/gs/src/int.mak
===================================================================
--- trunk/gs/src/int.mak 2007-09-23 21:41:51 UTC (rev 8248)
+++ trunk/gs/src/int.mak 2007-09-24 03:52:18 UTC (rev 8249)
@@ -527,7 +527,7 @@
Z2OPS=zdict1 zdict2 zfile zfile1 zfileio1 zfileio2
Z3_4OPS=zfilter zfproc zgeneric ziodev zmath zalg
Z5_6OPS=zmisc zpacked zrelbit zstack zstring zsysvm
-Z7_8OPS=ztoken ztype zvmem zbfont zchar zcolor
+Z7_8OPS=ztoken ztype zvmem zbfont zchar_a zchar_b zcolor
Z9OPS=zdevice zfont zfontenum zgstate1 zgstate2 zgstate3
Z10OPS=zdfilter zht zimage zmatrix
Z11OPS=zpaint zpath pantone
Modified: trunk/gs/src/zchar.c
===================================================================
--- trunk/gs/src/zchar.c 2007-09-23 21:41:51 UTC (rev 8248)
+++ trunk/gs/src/zchar.c 2007-09-24 03:52:18 UTC (rev 8249)
@@ -364,9 +364,24 @@
return 0;
}
+/* Export in_cachedevice flag for PDF interpreter, which, unlike
+ * PS unterpreter, ignores color operations in the inappropriate context.
+ */
+/* - .incachedevice <bool> */
+private int
+zincachedevice(i_ctx_t *i_ctx_p)
+{
+ os_ptr op = osp;
+
+ push(1);
+ make_bool(op, !!igs->in_cachedevice);
+ return 0;
+}
+
+
/* ------ Initialization procedure ------ */
-const op_def zchar_op_defs[] =
+const op_def zchar_a_op_defs[] =
{
{"3ashow", zashow},
{"6awidthshow", zawidthshow},
@@ -388,6 +403,12 @@
op_def_end(0)
};
+const op_def zchar_b_op_defs[] =
+{
+ {"0.incachedevice", zincachedevice},
+ op_def_end(0)
+};
+
/* ------ Subroutines ------ */
/* Most of these are exported for zchar2.c. */
More information about the gs-cvs
mailing list