Dec 232017
Utility for printing HPGL plotter files on a Postscript Printer. Includes C source code.
File HPGL2PS.ZIP from The Programmer’s Corner in
Category Printer Utilities
Utility for printing HPGL plotter files on a Postscript Printer. Includes C source code.
File Name File Size Zip Size Zip Type
CHANGESI.C 1687 695 deflated
CIRCLE.C 2008 493 deflated
DEFN.H 3260 1302 deflated
DXY2PS.C 1864 799 deflated
DXY2PS.EXE 49514 20511 deflated
DXY2PS.MAN 2785 1327 deflated
DXY2PS.MK 534 280 deflated
DXY2PS.TL 250 163 deflated
DXYCOM.C 2579 857 deflated
END_DRAW.C 224 161 deflated
EXT.H 2945 1282 deflated
GETOPT.C 1150 472 deflated
GETVAL.C 1198 606 deflated
HPGL2PS.C 2801 1125 deflated
HPGL2PS.EXE 49694 20615 deflated
HPGL2PS.MAN 3920 1609 deflated
HPGL2PS.MK 629 323 deflated
HPGL2PS.TL 290 161 deflated
HPGLCOM.C 13497 2737 deflated
LINESIZE.C 322 210 deflated
LINETYPE.C 2890 916 deflated
LPIRPRP.PS4 19990 3951 deflated
MANUALFE.C 627 319 deflated
PERF.PLT 35426 8648 deflated
PLOTCOOR.C 1347 532 deflated
PLOTDOT.C 746 400 deflated
PLOTINIT.C 1525 659 deflated
PLOTPS.C 1361 495 deflated
PS_MACRO.C 4799 1030 deflated
README 4812 2191 deflated
RECTANGL.C 711 298 deflated
TEST.HPG 5794 1653 deflated
TEST1.DXY 255 129 deflated
TEST1.HPG 1095 368 deflated
TEST3.HPG 1116 350 deflated
TEXTPS.C 2014 702 deflated
TICK.C 1445 547 deflated
USERDEFC.C 3103 1187 deflated
VIEWPORT.C 2264 895 deflated

Download File HPGL2PS.ZIP Here

Contents of the README file

/* hpgl2ps.pckd - enhanced version */
/* hpgl2ps.ucb - Further enhanced version */

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.


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.

 December 23, 2017  Add comments

Leave a Reply