Skip to content
Surf Wiki
Save to docs
linguistics

From Surf Wiki (app.surf) — the open knowledge base

HP-GL

Printer control language created by Hewlett-Packard (HP)


Printer control language created by Hewlett-Packard (HP)

FieldValue
nameHewlett-Packard Graphics Language
mimeapplication/vnd.hp-HPGL

HP-GL, short for Hewlett-Packard Graphics Language and 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 was introduced with the plotter HP-9872 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 (mnemonics), 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 (not used here) specifies how far the arc continues, and defaults to 5 degrees.

When first introduced, HP-GL contained the following commands:

CommandMeaningVector GroupCharacter GroupLine Type GroupDigitize GroupAxesSet-Up GroupConfiguration Status
`PA` x,y{,x,y{...}}Plot absolute [i]
`PR` x,y{,x,y{....}}Plot relative [i]
`PD`Pen down
`PU`Pen up
`CA` nDesignate alternate character set n [i]
`CP` spaces, linesCharacter plot [d]
`CS` mDesignate standard set m [i]
`DI` run, riseAbsolute direction [d]
`DR` run, riseRelative direction [d]
`LB` c, ..., cLabel ASCII string [c]
`SA`Select alternate character set
`SI` wide, highAbsolute character size [d]
`SL` tan θAbsolute character slant (from vertical) [d]
`SR` wide, highRelative character size [d]
`SS`Select standard character set
`UC` x, y, pen{, ...}User defined character [i]
`LT` t{,l}Designate line type t and length l [d]
`SM` cSymbol mode [c]
`SP` nSelect pen [i]
`VA`Adaptive velocity
`VN`Normal velocity
`VS` v{,n}Select velocity v for pen n [i]
`DC`Digitize clear
`DP`Digitize point
`OC`Output current position and pen status
`OD`Output digitized point and pen status
`TL` tp{,tn}Tick length [d]
`XT`X axis tick
`YT`Y axis tick
`IP` p1x,p1y,p2x,p2yInput p1 and p2 [i]
`IW` xlo,ylo,xhi,yhiInput window [i]
`OP`Output p1 and p2 [i]
`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]
w,hset 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 (text file) format, for instance:

CommandMeaning
initialize, start a plotting job
set the scaling points (P1 and P2) 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 (draw a box around the page)
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 (the 1, meaning "true")
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 (i.e. 40 units per millimeter, 1016 per inch). The coordinate space was positive or negative floating point numbers, specifically ±230.

{{anchor|HPGL2}}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.

CommandMeaning
NPxnumber of pens; x=1..256
PCx,r,g,bpen color; x=pen, r=red, g=green, b=blue, 0..255
PWw,xpen 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 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 as several HP-GL instructions to the plotter.

References

References

  1. (September 1977). "Easy-to-Use Interface Language Controls HP-IB Plotter". [[Hewlett-Packard Journal]].
  2. (September 1990). "PCL 5 Printer Language Technical Reference Manual". [[Hewlett-Packard Company]].
Info: Wikipedia Source

This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page.

Want to explore this topic further?

Ask Mako anything about HP-GL — get instant answers, deeper analysis, and related topics.

Research with Mako

Free with your Surf account

Content sourced from Wikipedia, available under CC BY-SA 4.0.

This content may have been generated or modified by AI. CloudSurf Software LLC is not responsible for the accuracy, completeness, or reliability of AI-generated content. Always verify important information from primary sources.

Report