
 gemgs 1.3 - Ghostscript For Atari
 ---------------------------------

Well, actually the version 1.2 from January 1999 was to have been officially
the last version from me, but now there is a new version!
I went to Frankfurt to study, whilst my TT remained in Hamburg. I
wanted to to stay faithful to the Atari platform, so I installed STonX with
N.AES and a cross-compiler on the Linux PC on which to translate Atari
programs. Just as this environment was running stably, GS version 6.01
appeared from Aladdin - and there, I thought, was the ideal test for the new
programming environment! Gemgs is essentially the new GS kernal 6.01, with
some new laser printer drivers which appeared along the way.


 Here now are the real instructions for gemgs
 --------------------------------------------

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 6.01 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
6.01. The following drivers have been compiled into the interpreter:

 Dot-matrix printers:
	epson		Epson-compatible dot matrix printers (9- or 24-pin)
	lq850		Epson LQ850 printer, also Canon BJ300 (LQ850 emu)
	necp6		NEC P6/P6+/P60 printers at 360 x 360 DPI resolution

 Inkjet 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
	st800		Epson Stylus 800 printer
	stcolor		Epson Stylus Color

 Laser printers:
  	cljet5		H-P Color LaserJet 5/5M
  	cljet5c		H-P Color LaserJet 5/5M
	fs600		Kyocera FS-600 (600 dpi)
	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)
	lj5mono		H-P LaserJet 5 & 6 family (PCL XL), bitmap
	lj5gray		H-P LaserJet 5 & 6 family, gray-scale bitmap
	pxlmono		H-P black-and-white PCL XL printers (LaserJet 5 and 6 family)
	pxlcolor	H-P color PCL XL printers (none available yet)
	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 1.3 consists of the following six archives:

	gemgs13-bin.lzh		The  program  for ST and MagiCMac/PC.
	gemgs13-doc.lzh		Documentation and example dokuments from Aladdin gs 6.01.
	gemgs13-fnt1.lzh	Fonts from Aladdin 6.0
	gemgs13-fnt2.lzh
	gemgs13-lib.lzh		The  PS-files from Aladdin 6.01.

	gemgs13-src.tgz		Source text and patches for the  gs-kernal 6.01.

After unpacking, the following file structure should be created:

	gemgs/
		doc/			gs 6.01 instructions in HTML format

		example/		Example documents

		fonts/			fonts

		lib/			Control files for gs 6.01

		pdf2ps/			Tool to extract page information from PDF files

		gemgs.gtp		The  interpreter in GEM format in ST and TT versions
		gemgs030.gtp
		gemgs.rsc
		gemgs.cfg

		Readme.txt	    This file
		History.txt		Development history

   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

gemgs also searches for the  files in the  UNIX paths
/usr/lib/ghostscript/6.01/lib or /usr/lib/ghostscript/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, and you can open files using Drag&Drop onto the window.

   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
      Jump 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 relatively 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).

	That's that for the moment, but this time I'm not going to publish
	any of my plans publically. But who knows what the future might bring... ;-))

Christian Felsch
felsch@tu-harburg.de
25 March 2000

English translation:
Peter West of TransAction/DDP Translations
xlator@cix.co.uk
Derryck Croker of DDP Translations
derryck@cix.co.uk



