HP-GL
HP-GL, short for Hewlett-Packard Graphics Language and often written as HPGL, is a printer control language created by Hewlett-Packard. HP-GL was the primary printer control language used by HP plotters. It was introduced with the plotter in 1977 and became a standard for almost all plotters. Hewlett-Packard's printers also usually support HP-GL/2 in addition to PCL.
Design
The language is formed from a series of two letter codes, followed by optional parameters. For instance an arc can be drawn on a page by sending the string:AA100,100,50;
This means Arc Absolute, and the parameters place the center of the arc at absolute coordinates 100,100 on the page, with a starting angle of 50 degrees measured counter-clockwise. A fourth optional parameter specifies how far the arc continues, and defaults to 5 degrees.
When first introduced, HP-GL contained the following commands:
Formats:
- : integer formats between -32767 and 32768. No decimal point.
- : decimal format between +/- 127.9999. Optional decimal point.
- : ASCII character
Examples
Command | Meaning |
initialize, start a plotting job | |
set the scaling points to their default positions | |
select pen 1 | |
lift Pen Up and move to starting point for next action | |
put Pen Down and move to the following locations | |
Pen Up and move to X,Y coordinates 50,50 | |
draw a circle with radius 25 | |
select the standard character set | |
set the text delimiter to the asterisk, and do not print them | |
lift the pen and move to 20,80 | |
draw a label |
The coordinate system was based on the smallest units one of the HP plotters could support, and was set to 25 µm.
The coordinate space was positive or negative floating point numbers, specifically ±230.
HP-GL/2
The original HP-GL language did not support definition of line width, as this parameter was determined by the pens loaded into the plotter. With the advent of the first inkjet plotters, line width for the "pens" specified within the HP-GL files had to be set at the printer so it would know what line width to print for each pen, a cumbersome and error-prone process. With Hewlett-Packard Graphics Language/2 aka HP-GL/2, definition of line width was introduced into the language and allowed for elimination of this step. Also, among other improvements a binary file format was defined that allowed for smaller files and shorter file transfer times, and the minimal resolution was reduced..Command | Meaning |
NPx | number of pens; x=1..256 |
PCx,r,g,b | pen color; x=pen, r=red, g=green, b=blue, 0..255 |
PWw,x | pen width; w=pen width in mm with decimal point, x=pen |