Ghostscript 4.01 BeOS Alpha 2 README ------------------------------------ This is the second alpha release of my port of Aladdin Ghostscript 4 to BeOS. This program will interpret Postscript and PDF files and convert them to various image and inkjet/dot-matrix printer formats, including PCX, TIFF, and PNG. By default it will display them on your screen using the new BeBox GUI module. Here is a list of changes since the last release: * BeBox GUI. This is a child of the BView class called PSView. It works reasonably quickly, but there is quite a bit of room for improvement. For example, a future version of the GUI will substitute Be's native TrueType fonts for Adobe fonts where appropriate. * Extensive use of shared libraries. Ghostscript now requires JPEG and PNG shared libraries, which are available from www.be.com. Ghostscript itself is now a shared library, libgs.so, suitable for linking with your own programs (see below). The next version, due in late September, will include a port of GSView, a graphical front-end to Ghostscript which will support moving to arbitrary pages, zooming, printing, text search, and other nice features. This version requires DR7 of BeOS, the next version will require DR8. Installation: ------------- You MUST download and install the JPEG, PNG, and ZLIB packages before installing this package. They are available from the same location where you downloaded this: The BeWare archive at www.be.com. Use the following commands to extract the binary archives: $ zcat ghostscript-4.01alpha2-beos.tar.gz | tar xvf - $ zcat ghostscript-fonts-std-4.0.tar.gz | tar xvf - In this release you must manually install the files. This will be fixed in the next release: * Move the files in the "bin" directory to a place in your path (for example "/boot/local/bin"). * "mkdir -p /boot/local/share/ghostscript" and move the "4.01" and "fonts" directories to /boot/local/share/ghostscript/4.01 and /boot/local/share/ghostscript/fonts respectively. NOTE: If you choose a directory other than /boot/local/share/ghostscript to install Ghostscript, for example /boot/PostScript/gs4, then you must set the GS_LIB variable to contain both paths, for example (place this in your /system/UserBootscript or /boot/.profile to set it permanently): $ export GS_LIB=/boot/PostScript/gs4/4.01:/boot/PostScript/gs4/fonts To uninstall Ghostscript, remove the directory containing the fonts, data files, and documentation (/boot/local/share or wherever you installed it), the Ghostscript binaries (default in /boot/local/bin) and the shared libraries libgs.so and libgs.so.xMAP. If you don't need the JPEG or PNG libraries anymore, you can also remove libjpeg.so, libjpeg.so.xMAP, libpng.so, libpng.so.xMAP, libz.so, and libz.so.xMAP from /system/lib. Using Ghostscript: ------------------ The documentation is in the "4.01/doc" folder, and there are some sample Postscript files in "4.01/examples". For example, to view a picture of a tiger, cd to the 4.01/examples folder, and type: $ gs tiger.ps This should output a nice image of the tiger on your screen. Press the close button of the window or type "quit" at the GS> prompt to quit. It looks best in 32-bit color mode, but looks reasonable in 256 colors. If you view a multiple page document, you must go to the Terminal window where you started Ghostscript, and press Return to view the next page (this will be fixed in the next version when I have a proper viewer front-end). Please look at the documentation, including the license agreement (in a file called "PUBLIC" in the doc folder), and experiment with the different options. Let me know if you find any bugs! Troubleshooting: ---------------- If you receive a "cannot execute binary file" or "Error launching..." message when attempting to run Ghostscript, verify that libjpeg.so, libpng.so and libz.so are present in /system/lib and that libgs.so is in the same directory as "gs" or in /system/lib. If you have any other problems, please e-mail me: jehamby@lightside.com Known Bugs: ----------- When viewing some files with very large bitmaps, the screen can get corrupted after a refresh (minimizing/restoring the window, changing the color depth, or scrolling). This is due to the nature of my Draw() function, which holds a pointer to the original bitmap, which Ghostscript's garbage collector writes over under low-memory conditions. Using libgs in your own programs: --------------------------------- The source code to the gs executable is included in the src directory. As you can see, it is still pretty messy. I've used the same "DLL" API as the Windows and OS/2 version of Ghostscript. This is fully documented in dll.txt in the original Ghostscript source code archive (see below). The only difference is that the gsdll_lock_device() is not currently written (because the PSView is automatically threadsafe), and the "HWND" type is defined as a PSView class instead of its MS-Windows meaning. Unfortunately, due to Ghostscript's extensive use of global variables, you can only open one PSView per program. I will include more documentation in the next release, as well as a sample program or two to demonstrate using a PSView similarly to Display PostScript on other operating systems. Thanks for your patience! Building Ghostscript from source: --------------------------------- In the directory where you downloaded this program, I have copied the Ghostscript source code. This is the same as the version available on ftp.cs.wisc.edu in /ghost. First, you must download and install the GNU patch program, available from ftp.be.com in: /pub/contrib/util/patch-2.1-be.tar.gz After you have downloaded ghostscript-4.01.tar.gz, type the following: $ zcat ghostscript-4.01.tar.gz | tar xvf - $ cd gs4.01 $ cp -pr ../Ghostscript/patches/* . $ cat patch.? | patch -p0 $ rm patch.? If the "patches" directory which came with this archive is in a different location relative to gs4.01, then substitute that path on the third line above. Now, type the following commands to create the makefile, compile the program, and (optionally) install it: $ ./tar_cat $ cp beosmwcc.mak makefile $ make $ make install To compile the front-end for the shared library: $ mwcc -o gs gsfront.cpp -lgs Here are some notes about my changes: * Do not edit the makefile directly. Instead, modify one of: mwcchead.mak, unixhead.mak, beostail.mak, or unix-end.mak, and rerun the shell script "tar_cat". This will recreate beosmwcc.mak, and you can recopy it to "makefile". As you can see, the BeBox-specific Makefile changes have been made to mwcchead.mak and beostail.mak, which are based on ansihead.mak and unixtail.mak, respectively. * You can now use -O6 or -O7 optimization. I have patched idict.c to work around a bug in Metrowerks at those optimization levels. * Do not try to link LIBMOTO (a library from Motorola with fast math, string, and memory copy functions) with Ghostscript. It causes a stack underflow error in the Postscript operand stack. Summary: -------- Please help me try to make Ghostscript as Be-friendly as possible. If you have any comments or suggestions, please E-Mail to me, at: jehamby@lightside.com You can download the latest version of Ghostscript, and other Be programs I've written from Be's Web site: http://www.be.com/ Enjoy!