[gs-cvs] rev 7219 - trunk/gs/lib
ray at ghostscript.com
ray at ghostscript.com
Wed Nov 22 12:22:57 PST 2006
Author: ray
Date: 2006-11-22 12:22:57 -0800 (Wed, 22 Nov 2006)
New Revision: 7219
Modified:
trunk/gs/lib/pdf_base.ps
Log:
Read the JBIG2 Global Context from the stream as an array of strings to
create the correct size bytestring for .jbig2makeglobalctx. Bug 689005
for customer 870.
DETAILS:
The /Length element of the the stream dict is the uncomressed size.
This example used FlateDecode on the Global context (which is sort of
dumb because except for the headers, most of the symbol dict is already
compressed -- in this case it saved a whole 36 bytes = 0.2%).
Tested with a smaller string (2000 instead of 60000) since the test
file only needed 18654 bytes.
EXPECTED DIFFERENCES:
None.
Modified: trunk/gs/lib/pdf_base.ps
===================================================================
--- trunk/gs/lib/pdf_base.ps 2006-11-22 19:56:29 UTC (rev 7218)
+++ trunk/gs/lib/pdf_base.ps 2006-11-22 20:22:57 UTC (rev 7219)
@@ -836,11 +836,15 @@
% JBIG2Decode filter implementation looks for in the parm dict.
/jbig2cachectx { % <parmdict> jbig2cachectx <parmdict>
dup /JBIG2Globals knownoget {
- dup /Length oget
% make global ctx
- PDFfile fileposition 3 1 roll % resolvestream is not reentrant
- exch true resolvestream exch .bytestring
- .readbytestring pop .jbig2makeglobalctx
+ PDFfile fileposition exch % resolvestream is not reentrant
+ true resolvestream % stack after: PDFfileposition -file-
+ % Read the data in a loop until EOF to so we can move the strings into a bytestring
+ [ { counttomark 1 add index 60000 string readstring not { exit } if } loop ]
+ exch pop 0 1 index { length add } forall % compute the total length
+ % now copy the data from the array of strings into a bytestring
+ .bytestring exch 0 exch { 3 copy putinterval length add } forall pop
+ .jbig2makeglobalctx
PDFfile 3 -1 roll setfileposition
1 index exch
/.jbig2globalctx exch put
More information about the gs-cvs
mailing list