[comp.lang.postscript] EPS and array packing mode

cet1@cl.cam.ac.uk (C.E. Thompson) (03/20/90)

Can an EPS file assume a particular value for 'currentpacking', or should
it set the value if necessary? Conversely, must it restore the value if it
changes it? There doesn't seem to be anything explicit in the Adobe
documentation about this.

Chris Thompson
JANET:    cet1@uk.ac.cam.phx
Internet: cet1%phx.cam.ac.uk@nsfnet-relay.ac.uk

glenn@heaven.woodside.ca.us (Glenn Reid) (04/09/90)

In article <1832@gannet.cl.cam.ac.uk> cet1@cl.cam.ac.uk (C.E. Thompson) writes:
>Two weeks ago, in article <1813@gannet.cl.cam.ac.uk>, I wrote 
>>
>>Can an EPS file assume a particular value for 'currentpacking', or should
>>it set the value if necessary? Conversely, must it restore the value if it
>>changes it? There doesn't seem to be anything explicit in the Adobe
>>documentation about this.

An EPS file should be able to assume that 'currentpacking' is 'false', since
things can break if it isn't (like writing into an array).  The host program
should definitely restore the packing before it includes an EPS file.

But, I would recommend setting it to what you want, and returning it to what
it was before you started.  It's pretty easy, and provides the maximum
amount of protection for both you and your surrounding environment.  This
is generally the right idea for anything resembling EPS; leave the
environment as you found it, and 

/currentpacking where { %if
    pop % dictionary from "where" operator
    /pack currentpacking def
    true setpacking
} if

% your stuff here

/setpacking where { %if
    pop
    pack setpacking
} if


/Glenn
pop