 gemgs 1.2 - Ghostscript for Atari
 ---------------------------------

gemgs is a port of the well-known Postscript viewing and printing program
from GNU for Atari TOS/MiNT/MagiC.
I have taken the port of Version 3.53 by Tim Gallivan as a basis and
cleaned up and revised the whole source text. The program received a new
user interface, which suffices for the European GEM standard :-)
During development new Ghostscript versions became available, which were
then immediately incorporated into gemgs. Thus gemgs makes a current
Ghostscript 5.50 available for the Atari, with which PS- and EPS- as well
as now PDF-files may be viewed (see below) and printed out on the Atari.


General:
--------

Since Ghostscript is actually a command-line oriented program, one really
needs a second program for displaying output in a window (e.g. ghostview
under UNIX) that runs in parallel to the actual interpreter. Tim Gallivan
in his port has integrated the complete GEM front-end into the interpreter.
This has the advantage that no communication with a second program is
necessary and thus no multitasking system is required. The disadvantage
of this method is, however, that the GEM portion is only active at certain
times to, say, redraw the windows. If a graphic is in the process of being
interpreted the GEM portion is non-active and it looks as if something
has remained hanging.

This concept has been retained in gemgs, as I personally wanted to have a
Ghostscript that would run under Single-TOS and I didn't want to re-program
everything. Process communication realised with pipes would presumably not
be a problem under MiNT, as one could use the UNIX-driver for X11 as a
model. But that version would then not work with MagiC, since MagiC still
does not support fork()  :-((

As already mentioned, gemgs is based on the current Ghostscript version
5.10. The following drivers have been compiled into the interpreter:

  Printers:
  ---------
   bj10e        Canon BubbleJet BJ10e
   bj200        Canon BubbleJet BJ200
   bjc600       Canon Color BubbleJet BJC-600, BJC-4000 and BJC-70
   bjc800       Canon Color BubbleJet BJC-800
   cdj500       H-P DeskJet 500C (same as cdjcolor)
   cdj550       H-P DeskJet 550C/560C/660C/660Cse
   deskjet      H-P DeskJet and DeskJet Plus
   djet500      H-P DeskJet 500; use -r600 for DJ 600 series
   epson        Epson-compatible dot matrix printers (9- or 24-pin)
   laserjet     H-P LaserJet
   ljetplus     H-P LaserJet Plus
   ljet2p       H-P LaserJet IId/IIp/III* with TIFF compression
   ljet3        H-P LaserJet III* with Delta Row compression
   ljet4        H-P LaserJet 4 (defaults to 600 dpi)
   lq850        Epson LQ850 printer, also good for Canon BJ300 (LQ850 emu)
   necp6        NEC P6/P6+/P60 printers at 360 x 360 DPI resolution
   st800        Epson Stylus 800 printer
   stcolor      Epson Stylus Color
   slm          Atari SLM laser printer


  File formats:
  -------------
   epswrite     EPS output (like PostScript Distillery)
   gemimg       Atari GEM image file format
   jpeg         JPEG format, RGB output
   jpeggray     JPEG format, gray output
   pdfwrite     PDF output (like Adobe Acrobat Distiller)
   pngmono      Monochrome Portable Network Graphics (PNG)
   pnggray      8-bit gray Portable Network Graphics (PNG)
   png16        4-bit color Portable Network Graphics (PNG)
   png256       8-bit color Portable Network Graphics (PNG)
   png16m       24-bit color Portable Network Graphics (PNG)
   pswrite      PostScript output (like PostScript Distillery)
   tiff12nc     TIFF 12-bit RGB, no compression
   tiff24nc     TIFF 24-bit RGB, no compression (NeXT standard format)
   tifflzw      TIFF LZW (tag = 5) (monochrome)
   tiffpack     TIFF PackBits (tag = 32773) (monochrome)



Installation:
-------------

   gemgs consists of the following parts:

   gemgs.rsc
   gemgs.gtp
   gemgs.cfg      The interpreter in GEM-format
   LiesMich       This file in German
   Readme         This file in English
   History.txt    Development history in German
   History.Eng    Development history in English

      ps/...      The Postscript control file for the interpreter
                  as well as demo images.

      fonts/...   The official fonts 5.x

      pdf2fs\     Tool for extraction of page information from PDF files

   The whole is divided into 6 archives:

      gemgs12-TT.lzh   The version 1.2 for TT/Falcon (68030/68881).
      gmg11_ST.lzh     The version 1.2 for ST and MagiCMac/PC.
      ps-550.lzh       The PS-files.
      fonts-1.lzh
      fonts-2.lzh      The fonts. In my opinion one only needs the *.pfb
                       from fonts-1.lzh. I don't know what the *.afm
                       and *.pfm (fonts-2.lzh) are there for.

      gemgs12-src.tgz  Source text as well as patches for the
                       gs-kernel 5.50.

    The whole thing should be installed with the following directory
    structure (on drive X: in the example):

      X:\gemgs\
      drwxrwx---   1 root     wheel           0 Jul  1  1997 fonts/
      drwxrwx---   1 root     wheel           0 Jan 29  1998 ps/
      -rw-rw----   1 root     wheel         303 Mar  1 19:53 gemgs.cfg
      -rwxrwx---   1 root     wheel     1039013 Jul 11 19:22 gemgs.gtp
      -rw-rw----   1 root     wheel       11810 Jul 11 17:16 gemgs.rsc
      -rwxrwx---   1 root     wheel       11631 Dec 28 16:13 pdf2ps.ttp

      X:\gemgs\fonts\
         *.pfb

      X:\gemgs\ps\
         *.ps

   After the archives have been unpacked one should open the gemgs.cfg
   file with an editor.
   You then have to insert the paths to the control files and the fonts
   into this file:

      setenv GS_LIB=X:\gemgs\ps,X:\gemgs\fonts

   In addition you can enter the following items:

     GDOS font for the Console window (ID and size in points)
      fontid 64
      fontpts 9

      Environment:
      setenv TMPDIR=x:\    Temporary directory

      setenv GS_DISPLAY    This controls something during colour output.
      As I only run in monochrome, I can't say anything about this.
      In any case, gemgs understands 'chunky8' and 'truecolor'.

      setenv GS_OPTIONS    Here one may input a parameter string, but I
      don't know what effect it has on gemgs  :-)

      setenv GS_DEVICE     Sets the default device. Not evaluated at
                           present by gemgs!

   From within gemgs only the window position and size as well as the
   user-defined resolution will be saved to this file. All other entries
   can only be altered with the editor!


Operation:
----------

   When gemgs is started the menu appears and a Console window opens. It
   then takes a little time for the interpreter to initialise itself (one
   of the above-named situations where the GEM portion is inactive!).
   gemgs is ready for action as soon as the input prompt appears in the
   Console window:

      GS>

   Those who would like to program Postscript by hand can now start to
   type in the commands :-)
   All others who just want to take a look at a file can now do this via
   the menu entry 'File/Open'.

   gemgs evaluates its command line, i.e. one can install it as an
   application for *.ps, *.eps and *.pdf files. Naturally VA_START is
   also evaluated.

   During opening, gemgs behaves a little differently to the old Version
   3.54. At first gemgs attempts to establish how many pages there are in
   the document. If this succeeds, the pages are extracted individually
   from the document (to the Temp directory) and can then be viewed one by
   one. One can recognise this page mode by several things:

   - The Console does not show the document name but two lines of the
     type 'p:/gs_pro.ps' and 'p:/gs_pg1.ps'
   - The window title contains page information consisting of the
     current page and the total number of pages.

   In the page mode one can wander through the document in any desired
    manner. Three menu entries are provided for this:
      Next page
      Previous page
      Go to page...

   With the right mouse button you can bring up a popup that contains the
   entries from the 'File' menu. This makes it very easy to navigate
   through a document.

   The page mode ought to work with all multi-page documents.
   Should this not work occasionally, then one can only browse forwards
   through the document in the Console window with the [Return] key.
   In addition one has to work one's way through the entire document
   before a new one can be opened!! If anyone finds such a document,
   please send it to me!


How do I print with gemgs?
--------------------------

   Assumption: gemgs is already running and is awaiting input.
   Open the 'Output' dialog, then proceed as follows:
      1. Select a document. If a document was already opened for display
         then its name will be present already in the corresponding
         field.
      2. Select output device. A dialog appears in which the type of
         output (printer or file format) should be activated and a
         corresponding driver chosen.
         When the dialog is closed the interpreter switches over and
         brings up a message in the Console window.
      3. Select output channel. The available choice is the printer port
         (via GEMDOS) or diversion to a file. The choice is again
         confirmed in the Console window.
      4. Set resolution. Several resolutions are available for selection;
         if the desired one isn't present choose 'free' in the popup and
         enter the resolution into the edit field from the keyboard.
      5. Now at last you can activate the 'Start' button and after a
         short pause the printer should start to print or the output file
         should be written.

   gemgs takes DIN A4 as the standard paper format, but this can be
   altered easily via the corresponding menu entry.
   Unfortunately the chosen settings cannot be be saved to the CFG file,
   as they cannot be set automatically when gemgs starts up. This is a
   definite disadvantage when the GEM interface is incorporated into the
   interpreter.

   For those who find all this GEM-clicking too much and want to go the
   quick way via the command line, can type in the following into Mupfel,
   for instance, or construct a corresponding script:

   gemgs.gtp --no-gem -dNOPAUSE -sDEVICE=lq850 -r180
             -sOutputFile=PRN: mini.ps quit.ps

   This command outputs the file mini.ps to an Epson printer on the
   printer port at 180 DPI. The parameters should actually be obvious:
      --no-gem       without GEM
      -dNOPAUSE      Do not wait for [Return] at the end of the page
      -sDEVICE=      Printer/file format driver
      -rXXX          Resolution
      -sOutputFile   Output channel (PRN: for printer)

   The   quit.ps  at the end ensures that gemgs terminates after printing.


How to view PDF files
---------------------

In principle gemgs is also suitable for viewing PDF files. But for this
gemgs is faced with a problem in establishing how many pages are contained
in the document. As there are many possibilities to create pages in PDF,
it is relative complicated to obtain this paging information.
Basically Ghostscript handles PDF files in this manner: Under Multitasking
environments (UNIX, OS/2, Win32) a second gs process is started in the
background in parallel to the actual viewer, which extracts the page info
from the PDF into a pipe or a temporary PostScript file with the aid of a
given script. The GS front-end (GhostView or GSView) then reads in this
pipe/file and one can then browse through the document.

I have not incorporated this parallel start in gemgs, since it is only
possible on a multi-OS and I wanted to make gemgs usable under TOS as well.
With MagiC a parallel start with a file in TEMP would presumably be
possible, but it would only be completely realisable under MiNT as with
this one would have the required fork() command for process splitting as
well as correctly working pipes available.
Another point against a parallel start is the fact that for a certain time
there would be /two/ gemgs in memory, which would not be possible on
'normal' Ataris due to gemgs' size.

To be able to browse in PDF with gemgs nevertheless, I collected various
PDFs and built into gemgs a small scanner which functioned very well with
the test PDFs.
But hardly had gemgs been published then there were, naturally, a heap of
PDFs with which the scanner would not work correctly.
For such documents all that remains is to perform the above-mentioned
parallel start manually:
For this one starts gemgs with the following parameters:

 gemgs -dNODISPLAY -sPDFname=d:/pdf/test.pdf -sDSCname=d:/pdf/test.ps pdf2dsc.ps

The absolute path of the PDF file is important, as this is incorporated
into the created PS file so that gemgs can later find the PDF file.
The resulting PS file is subsequently opened with gemgs and displays the
pages of the PDF file.
So that one does not have to input this command manually, gemgs 1.2 has
the program 'pdf2ps.ttp' included with it that gemgs calls with the above-
named parameters. 'pdf2ps' must be in the same directory as gemgs.gtp
and creates from the PDF file passed to it a PS file with the same name
(only the extension is changed from PDF to PS).

The second possibility to read PDF files with gemgs is the conversion of
the whole PDF file to a PS file:

 gemgs --no-gem -dNOPAUSE -sDEVICE=pswrite -sOutputFile=test.ps test.pdf quit.ps

For this the PS output is used, which behaves exactly like a printer
driver. But for the conversion one should note that some PDF files are
packed and the resulting PS code can then be appreciably larger!


Well, this should make the most important things clear.
Those needing more (general) info about Ghostscript should obtain the
detailed instructions (gs5man_d.pdf) in the InterNet (in German).


ATTENTION!
  gemgs 1.2 is the last version that I am publishing!

Since I now use Ghostscript on other (faster!) hardware, I have stopped
development of gemgs with version 1.2.
With this version I have now also made the source texts of gemgs freely
available, allowing someone else to take on further development.
It would be nice if someone could be found who could continue development
of gemgs for the Atari platform. More about the source text as well as
the steps to be taken for translation can be found in the source text
archive. Naturally I remain available to answer any questions about this.


Well, that's it! Have fun with the "Ghost for GEM"!

Christian Felsch
felsch@tu-harburg.de
3rd January 1999

English translation:
Peter West of TransAction.
xlator@cix.co.uk
