1612 1. General Information ---------------------- BB4GS.PS is a version of Bernie Cosell's %%BoundingBox calculator (bb.ps, v1.14, part of the bbfig package) which has been specifically modified to work with Ghostscript, the PostScript interpreter written by L. Peter Deutsch and distributed by the GNU project. [Note that a %%BoundingBox line is often extremely useful and possibly even necessary when including PostScript figures in a document being prepared with a typesetting program (such as TeX); discussing how to do this inclusion, however, is beyond the scope of this document, so it will be assumed that the reader already knows how to use this %%BoundingBox information once it is obtained. More information can be obtained in the PostScript Language Reference Manual, for example, or in the documentation which comes with the program dvips.] I originally used bb.ps to calculate %%BoundingBox parameters by prepending it to a file and then sending the whole thing to a Postscript printer. With the advent of Ghostscript, however, it was no longer necessary to waste paper, since the file could be previewed and the %%BoundingBox read directly. A very small number of changes have been made to bb.ps to make a version to use with Ghostscript. (In my opinion, this says quite a bit about the quality of this PostScript interpreter.) Nevertheless, I have changed the name to bb4gs to make sure there is no confusion with Bernie Cosell's original version. The detailed changes are documented in the file itself, but essentially, they: 1) increased the default font size for easy reading on small screens (like the PC's). 2) stubbed out the strokepath operator, which to the best of my knowledge is still not fully implemented in Ghostscript. 3) added a hook so that bb4gs can tell if the %%BoundingBox is to be displayed on the screen or sent to stdout (more later), so that in the latter case not more than one copy is sent. 4) (optional) replaced the show operator with print so that Ghostscript will send the %%BoundingBox to stdout. Currently this is commented out in bb4gs to allow the option (or not) of invoking this feature from the command line, but if it is decided that bb4gs will always be used in this manner the comments can be removed. (My thanks to Richard Murphey for this idea.) In addition to the file bb4gs.ps which does all of the work, there are some additional files included with it. They are: bbprint.ps - a file which can be used to replace the show operator with print so Ghostscript send the %%BoundingBox to stdout. bbget.bat - a batch file to invoke Ghostscript and send the %%BoundingBox information to the file bb.out bbget - a unix shell script to invoke Ghostscript to capture the %%BoundingBox information and insert it (using sed) in the proper place in the file. (This script was written by Richard Murphey .) noscreen.ps - a file to stub out the setscreen operator, which can cause `out of memory' errors (VMerror) on PCs. Note that use of this file doesn't always work, but it has helped on occasion. It is meant to be invoked on the command line before the desired file. 2. Use ------ Ghostscript accepts multiple filenames on the command line, so that the simplest way to invoke bb4gs to find the %%BoundingBox for the file example.ps is to type: gs bb4gs.ps example.ps Ghostscript will first load bb4gs.ps and then run example.ps, displaying the %%BoundingBox information on the screen when a showpage command is encountered (if the file example.ps doesn't have a showpage command in it, however, then it may be necessary to type the showpage manually at the Ghostscript GS> prompt). The PC batch file (bbget.bat) and unix shell script (bbget) merely invoke bbprint.ps first, which redirects Ghostscript output to stdout, then bb4gs.ps, and then finally the desired file. The batch file sends the resulting %%BoundingBox information to a file bb.out so that it can be placed manually in the PostScript file using a text editor, but the unix shell script calls sed which does the inserting automatically. (It is possible that such automatic insertion can be accomplished on the PC, but it didn't seem worth the effort to explore this further.) These files have been tested on numerous versions of Ghostscript, starting with version 1.3 and up to the current version 2.4, with no problems. (The PC versions were tested on both 286 and 386 machines, and the Unix version were tested on Sun Sparcstation 1s running SunOS 4.1.0.) They have not, however, been tested on all possible types of *PostScript* files, since there are so many of them available. If an example is encountered for which bb4gs *doesn't* work, an answer is probably more likely to be found by posting the problem on the USENET groups comp.lang.postscript or gnu.ghostscript.bug than by sending the file to me; I am unfortunately *not* really a PostScript expert (rather, in our department, I'm merely the best at *faking* it.) In any event, I hope these PostScript programs are useful. I have certainly found them to be. Bill Kath ---------------------------------- kath@nwu.edu Engineering Sciences and Applied Mathematics McCormick School of Engineering, Northwestern University . 0