|This article needs additional citations for verification. (September 2016) (Learn how and when to remove this template message)|
HP-GL (Hewlett-Packard Graphics Language; often written as HPGL) is a printer control language created by Hewlett-Packard (HP). HP-GL was the primary printer control language used by HP plotters. It later became a standard for almost all plotters. Hewlett-Packard's printers also usually support HP-GL/2 in addition to PCL.
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:
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 (not used here) specifies how far the arc continues, and defaults to 5 degrees.
When first introduced, HP-GL contained the following commands:
||Plot absolute [i]|
||Plot relative [i]|
||Designate alternate character set n [i]|
||Character plot [d]|
||Designate standard set m [i]|
||Absolute direction [d]|
||Relative direction [d]|
||Label ASCII string [c]|
||Select alternate character set|
||Absolute character size [d]|
||Absolute character slant (from vertical) [d]|
||Relative character size [d]|
||Select standard character set|
||User defined character [i]|
|Line Type Group|
||Designate line type t and length l [d]|
||Symbol mode [c]|
||Select pen [i]|
||Select velocity v for pen n [i]|
||Output current position and pen status|
||Output digitized point and pen status|
||Tick length [d]|
||X axis tick|
||Y axis tick|
||Input p1 and p2 [i]|
||Input window [i]|
||Output p1 and p2 [i]|
||Automatic pen pickup [i]|
||Set default values|
||Input e, s and p masks [i]|
||Output error [i]|
||Output status [i]|
- [i]: integer formats between -32767 and 32768. No decimal point.
- [d]: decimal format between +/- 127.9999. Optional decimal point.
- [c]: ASCII character
|IN;||initialize, start a plotting job|
|IP;||set the scaling points (P1 and P2) to their default positions|
|SP1;||select pen 1|
|PU0,0;||lift Pen Up and move to starting point for next action|
|PD100,0,100,100,0,100,0,0;||put Pen Down and move to the following locations (draw a box around the page)|
|PU50,50;||Pen Up and move to X,Y coordinates 50,50|
|CI25;||draw a circle with radius 25|
|SS;||select the standard character set|
|DT*,1;||set the text delimiter to the asterisk, and do not print them (the 1, meaning "true")|
|PU20,80;||lift the pen and move to 20,80|
|LBHello World*;||draw a label|
|LTlinetype,length||set line type and its repetition length|
|CSxx||set character set (e.g. 33 is German)|
|DIx,y||set direction of text given as the catheti|
|SIww,hh||set character width and height|
The coordinate system was based on the smallest units one of the HP plotters could support, and was set to 25 µm (i.e. 40 units per millimeter, 1016 per inch). The coordinate space was positive or negative floating point numbers, specifically ±230.
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.
|NPx||number of pens; x=1..256|
|PCx,r,g,b||pen color; x=pen, r=red, g=gree, b=blue, 0..255|
|PWw,x||pen width; w=pin width in mm with decimal point, x=pen|
HP-GL is related to AGL (A Graphics Language), an extension of the BASIC programming language. AGL was implemented on Hewlett-Packard minicomputers to simplify controlling a plotter. AGL commands describe the desired graphics plotting function, which the computer relays to the plotter as several HP-GL instructions to the plotter.
- ShareCAD, a free online HP-GL/PLT viewer
- Kyktir, a free viewer capable of showing HP-GL in PCL5 streams.
- Daniels, Thomas H.; Hennessee, Larry W. (September 1977). "Easy-to-Use Interface Language Controls HP-IB Plotter" (PDF). Hewlett-Packard Journal. 29 (1): 5. Archived (PDF) from the original on 2017-02-27. Retrieved 2016-09-12.
- PCL 5 Printer Language Technical Reference Manual (1st ed.). Hewlett-Packard Company. September 1990. HP Part No. 33459-90903. (NB. Chapter 15-21 also contain a description of HP-GL/2.)
- Hewlett-Packard Company, Barcelona Division (September 1996) . The HP-GL/2 and HP RTL Reference Guide - A handbook for Program Developers - Hewlett-Packard Graphics Language/2 - Hewlett-Packard Raster Transfer Language (draft 2, second ed.). Barcelona, Spain: Addison-Wesley Publishing Company. ISBN 0-201-63325-6. HP Part No. 5961-3526, 5959-9733. Archived from the original on 2017-02-27. Retrieved 2017-02-28.