# HP-GL

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/HP-GL
> Markdown URL: https://mediated.wiki/source/HP-GL.md
> Source: https://en.wikipedia.org/wiki/HP-GL
> Source revision: 1355288825
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

Page description language created by Hewlett-Packard (HP)

This article needs more citations. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed. Find sources: "HP-GL" – news · newspapers · books · scholar · JSTOR (September 2016) (Learn how and when to remove this message)

Hewlett-Packard Graphics Language Internet media type application/vnd.hp-HPGL

**HP-GL**, short for **Hewlett-Packard Graphics Language** and often written as **HPGL**, is a [page description language](/source/Page_description_language) created by [Hewlett-Packard](/source/Hewlett-Packard) (HP). HP-GL was the primary page description language used by HP [plotters](/source/Plotter).[1] It was introduced with the plotter [HP-9872](http://www.hpmuseum.net/display_item.php?hw=79) in 1977 and became a standard for almost all plotters. Hewlett-Packard's [printers](/source/Computer_printer) also usually support HP-GL/2 in addition to [PCL](/source/Printer_Command_Language).[2]

## Design

The language is formed from a series of two letter codes ([mnemonics](/source/Mnemonic)), followed by optional parameters. For instance an [arc](/source/Arc_(geometry)) 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](/source/Cartesian_coordinate_system) 100,100 on the page, with a starting angle of 50 [degrees](/source/Degree_(angle)) 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:

Command Meaning Vector Group PA x,y{,x,y{...}} Plot absolute [i] PR x,y{,x,y{....}} Plot relative [i] PD Pen down PU Pen up Character Group CA n Designate alternate character set n [i] CP spaces, lines Character plot [d] CS m Designate standard set m [i] DI run, rise Absolute direction [d] DR run, rise Relative direction [d] LB c, ..., c Label ASCII string [c] SA Select alternate character set SI wide, high Absolute character size [d] SL tan θ Absolute character slant (from vertical) [d] SR wide, high Relative character size [d] SS Select standard character set UC x, y, pen{, ...} User defined character [i] Line Type Group LT t{,l} Designate line type t and length l [d] SM c Symbol mode [c] SP n Select pen [i] VA Adaptive velocity VN Normal velocity VS v{,n} Select velocity v for pen n [i] Digitize Group DC Digitize clear DP Digitize point OC Output current position and pen status OD Output digitized point and pen status Axes TL tp{,tn} Tick length [d] XT X axis tick YT Y axis tick Set-Up Group IP p1x,p1y,p2x,p2y Input p1 and p2 [i] IW xlo,ylo,xhi,yhi Input window [i] OP Output p1 and p2 [i] Configuration Status AP Automatic pen pickup [i] DF Set default values IM e{,s{,p}} Input e, s and p masks [i] IN Initialize OE Output error [i] OS Output status [i]

Commands added (when?) SI w,h set character width and height

Formats:

- [i]: integer formats between -32767 and 32768. No decimal point.

- [d]: decimal format between +/- 127.9999. Optional decimal point.

- [c]: ASCII character

## Examples

Typical HP-GL files start with a few setup commands, followed by a long string of graphics commands. The file was in [ASCII](/source/ASCII) ([text file](/source/Text_file)) [format](/source/File_format), for instance:

An example HP-GL file Command Meaning 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

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](/source/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](/source/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](/source/Binary_file) format was defined that allowed for smaller files and shorter file transfer times, and the minimal resolution was reduced.

Examples of HP-GL/2 commands 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

## AGL

HP-GL is related to **AGL** (A Graphics Language), an extension of the [BASIC](/source/BASIC) programming language. AGL was implemented on Hewlett-Packard [minicomputers](/source/Minicomputer) to simplify controlling a plotter. AGL commands describe the desired graphics plotting function, which the computer relays as several HP-GL instructions to the plotter.

## See also

- [DMPL](/source/DMPL), another plotter language by Houston Instruments

- [Gerber format](/source/Gerber_format) is another plot-description format

- [Logo](/source/Logo_(programming_language)), a computer language with drawing commands similar to HP-GL

## References

1. **[^](#cite_ref-Hennessee_1977_1-0)** Daniels, Thomas H.; Hennessee, Larry W. (September 1977). ["Easy-to-Use Interface Language Controls HP-IB Plotter"](http://www.hpl.hp.com/hpjournal/pdfs/IssuePDFs/1977-09.pdf) (PDF). *[Hewlett-Packard Journal](/source/Hewlett-Packard_Journal)*. **29** (1): 5. [Archived](https://web.archive.org/web/20170227192359/http://www.hpl.hp.com/hpjournal/pdfs/IssuePDFs/1977-09.pdf) (PDF) from the original on 2017-02-27. Retrieved 2016-09-12.

1. **[^](#cite_ref-HP_1990_HP-GL/2_2-0)** *PCL 5 Printer Language Technical Reference Manual* (1st ed.). [Hewlett-Packard Company](/source/Hewlett-Packard_Company). September 1990. HP Part No. 33459-90903. (NB. Chapter 15-21 also contain a description of HP-GL/2.)

## Further reading

- [Hewlett-Packard Company, Barcelona Division](/source/Hewlett-Packard_Company) (September 1996) [1990]. [*The HP-GL/2 and HP RTL Reference Guide - A handbook for Program Developers - Hewlett-Packard Graphics Language/2 - Hewlett-Packard Raster Transfer Language*](http://www.hpmuseum.net/document.php?catfile=213) (draft 2, second ed.). Barcelona, Spain: [Addison-Wesley Publishing Company](/source/Addison-Wesley_Publishing_Company). [ISBN](/source/ISBN_(identifier)) [0-201-63325-6](https://en.wikipedia.org/wiki/Special:BookSources/0-201-63325-6). HP Part No. 5961-3526, 5959-9733. [Archived](https://web.archive.org/web/20170227193043/http://www.hpmuseum.net/document.php?catfile=213) from the original on 2017-02-27. Retrieved 2017-02-28.

## External links

- ["Hewlett-Packard Graphics Language Commands"](https://web.archive.org/web/20170227192501/http://www.sxlist.com/techref/language/hpgl/commands.htm). Archived from [the original](http://www.sxlist.com/techref/language/hpgl/commands.htm) on 2017-02-27.

- ["HP-GL Overview"](https://web.archive.org/web/20180613112357/http://cstep.luberth.com/HPGL.pdf) (PDF). Archived from [the original](http://cstep.luberth.com/HPGL.pdf) (PDF) on 2018-06-13.

- ["Chiplotle"](http://sites.music.columbia.edu/cmc/chiplotle/). Retrieved 2023-02-15. (NB. A Python-based HP-GL plotter control library for using vintage pen plotters with contemporary operating systems.)

v t e Hewlett-Packard software Applications and utilities ALM† Application Security Center Business Service Automation Business Service Management Client Automation Software Cloud Service Automation Software CommonPoint† Enterprise Security Products† iconv Information Management Software† Integrity Virtual Machines IT Management Software Linux Imaging and Printing* mscape Network Management Center† Open Extensibility Platform OpenMail OpenView Storage Area Manager OpenText Quality Center† QuickTest Professional† Release Control Remote Graphics Software* Service Activator** Service Manager† Serviceguard SiteScope† Snapfish Lab Systems Insight Manager** Tesseract† TRIM† Visual User Environment WinRunner Database Enscribe** NonStop SQL** UCMDB† File systems and formats Hi Performance FileSystem** System Object Model** Veritas File System‡ Operating systems and environments Domain/OS HP-UX** HyperSpace HP LX System Manager MPE NewWave NonStop OS** OpenVMS† QuickPlay Rocky Mountain BASIC Time-Shared BASIC Tru64 UNIX webOS† Protocols and languages ePrint* HP-GL InkML PowerHouse‡ Printer Command Language Raster Transfer Language Printer Job Language Systems Programming Language Universal Print Driver* Asterisk (*) denotes software continued by HP Inc. Double asterisk (**) denotes software continued by Hewlett Packard Enterprise Dagger (†) denotes software divested and sold off Double dagger (‡) denotes third-party software

Authority control databases: National United States Israel

---
Adapted from the Wikipedia article [HP-GL](https://en.wikipedia.org/wiki/HP-GL) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/HP-GL?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
