/*  hpgl2ps.pckd  - enhanced version */
/*  hpgl2ps.ucb   - Further enhanced version */
/*  hpgl2ps.mlb   - Enhanced even further */

There are two filters in this package which are based on the Roland
plotter command set.

1. DXY: A simple command set which is used with all DXY plotters

2. RD-GL: This command set is a superset of the HP (Hewlet Packard)
   graphics language.

Not all the commands of DXY or RD-GL (HPGL) are implemented (approx 95%
are) and those commands that are not are skipped and a warning given.
It is very easy to add to this filter if a particular unimplemented
command is desired.

If you wish to implement a command go to the relevant portion in the
command switch "dxycom.c" or "hpglcom.c" and call an appropriate user
written procedure.  (You will need a good knowledge of writing
PostScript programs)

The filters use the the procedure "getopt" which is used to interpret
command line options and arguments and is normally available on 4.3 bsd
and Sys V Unix. For those sites running 4.1 or 4.2 it may be available
as a local library and must be written into the Makefile.

IF YOU DONT HAVE GETOPT YOU WILL HAVE REWRITE THE CODE THAT INTERPRETS
COMMAND LINE OPTIONS AND ARGUMENTS.

NOTE 1: The method of writing text is not fully compatible with HPGL
and will be changed at a later date.

NOTE 2: The PostScript macros are written into a C procedure to allow
each filter to be a single stand alone program. These macros can easily
be incorporated into other filter programs.

I have written some test procedures for the testing of each filter they
are "test1.hpgl" for hpgl2ps and "test1.dxy" for dxy2ps.

Don McCormick.

-------------------------
Notes on first enhancement:

Support for user defined characters added by 
Gerald William Kokodyniak B.A.Sc. M.A.Sc.
University of Toronto, Department of Mechanical Engineering

-------------------------
Notes on second enhancement:
Support for Scaling, tickmarks, and better user defined characters
added by Gordon Jacobs, (Ph.D., since we're into titles above)
University of California, Berkeley in July 1989.

Mods were made ONLY for the hpgl2ps program and are not guaranteed
to work for dxy2ps.  HP-GL code from the Tektronix DSA 602
Digitizing Signal Analyzer (scope) were used as a test.
Laserwriter output was compared directly with plots from a
HP7550A plotter reading the same HP-GL file.

Support for scaling was added.
The Scaling involves re-setting the coordinate
system by re-calculating the XSCALE and YSCALE numbers and adding
an offset to the origin.  The offset had to be added to all files
that make use of the scaling parameters.

Tick marks were added with tick.c.  Uses relative draw commands
to make the tick marks and adds two global variables which are
the tick length as a percentage of the overall dimensions.

The parser was changed.  The SIGNED_NUMERIC macro recognized a comma
as a valid character which does not make sense.  The HP-GL code from
the DSA 602 often contains a mnemonic followed by a comma, but with
no parameters.  This is valid code although most sources will not
place a comma unless optional parameters actually follow.  The comma
was removed as a valid SIGNED_NUMERIC character and the function
getval() was modified to read all trailing commas and spaces.  In this way
the parser works for both the standard and odd case mentioned above.

The user defined character routine was modified heavily.  Original
function did not take into account the angle of characters.  The
new function reads the current angle of characters and orients
the user defined character in the same way.  The scaling, which was
originally huge for some reason now is dynamically set to a 
proportion of the size of regular text character.  The linewidth
of the user defined character is arbitrarily set to 0.25mm and
then the restored to the previous value.  This width seems to fit
the "linewidth" of the characters in the postscript helvetica
font sized for the DSA 602 output.

The default paper size is changed to be 8.5 x 11 inch paper with
command line options added to support all others.

The command line options -w and -h were added because the relative
scaling of fonts with the "SR" HP-GL command, while implemented
correctly, gives much smaller character sizes than the HP7550A plotter.
The defaults were set empirically to match plotter output.

The sizes in viewport.c were modified to get correct positioning
on the 8.5 x 11 paper when compared to a plot directly from the
HP7550A on the same type of paper.

The textps() routine was modified to move the position pointers to
the end of a string when a string is drawn.  This was commented out
in the code that I received, but needed to be restored for the
user defined character to be in the correct place.  The results
match the HP plotter for the same code.

----------------------
Notes on third enhancement:
All changes pertain to HPGL stuff only.

The removale of the comma in the SIGNED_NUMBER function was incorrect.
The problem was that some programs put out a comma after the PD command
and before the set of numbers.  This problem was fixed when the parser
was enhanced.  For some reason the change mentioned above in the previous
enhancement didn't work when the comma was followed by valid numbers.

The hpglcom.c parser was changed so that:
     1. All of the known HPGL commands (1984 HP 7580 plotter manual) have
	been added to the parser list, making it easier for someone to
	implement a command.
     2. All unknown commands had the data following that command, up until
	the next command, dumped.  This cleaned up the parser problem that
	I was seeing.
     3. Three new compilable options have been added:
	DEBUG:	When turned on, all PostScript output (after the macros)
		is put out on stderr, along with the HPGL commands.  This
		allows the programmer to see the input HPGL commands and
		the PostScript output.  The new AA command also puts out
		many of its computations.
	NOTIMP: Output all HGPL commands that are unknown.  If you don't
		want this list, turn off this compiler option.
	SYSV:	Many AT&T System V Unix systems don't have rint().  This
		option will use the very simple one that I included.
     4. The HPGL Absolute Arc (AA) command has been implemented.  The Arc
	Relative (AR) one has not (yet).  See the new routine arcps.c for
	further comments on what was done.

The default line sizes have been changed.  See the man page for the complete
list.
