This page gives the numbers behind the line and fill attribute instructions (LT UL LA PW WU FT RF SV AC TR SM SP), the polygon
instructions and the palette extension. It follows HP’s PCL 5 Printer Language Technical Reference Manual, Part II (chapters 19 to 22,
read for this page) and the PCL 5 Color Technical Reference Manual (chapter 7, the palette extension).
LT: line types
LT type[,length[,mode]], LT; (solid; the previous type and its unused part are saved) and LT99; (restore the previous type).
The type is a clamped integer from −8 to 8. The length is greater than 0 and defaults to 4% of the distance between P1 and P2; the mode is 0 (the
length is a percentage of that distance, the default) or 1 (the length is in millimetres). A length not above 0, or a mode other than 0 or 1, invalidates
the command. LT applies to lines drawn by AA AR AT CI EA EP ER EW FP PA PD PE PR RA RR RT WG and uses the line ends and joins set by LA.
- 0 draws only a dot at each point (a dot is a one-unit vector drawn with the current line end and pen width; zero-length vectors are drawn along the user’s X axis).
- 1 to 8 are fixed patterns: the pattern has the stated length and the unused part (the residue) carries into the next line. The residue is saved by
CI EA EP ER EW FP PM RA RR WGand restored with the pen position, and cleared byAC LA LT PW RF SP TR UL WU DF IN IP IR IW RO SC. - −1 to −8 are adaptive patterns: the length is adjusted so that each line holds one or more whole patterns (not for circles, arcs, wedges or polygons, where every one of the 72 chords would try to hold a whole pattern).
- 99 restores the previous type (and the residue of a fixed one) only if a solid type is in force and the pen has not moved since the non-solid line ended.
A pattern is a list of lengths alternating pen down, pen up, starting pen down, as fractions of the pattern length. These are the values the printer
uses (they are also those of GhostPDL’s pcl/pcl/pglfill.c, hpgl_fixed_pats and hpgl_adaptive_pats, read for this
page, matching the manual’s figure 22-17):
| Type | Fixed pattern | Adaptive pattern (type −n) |
|---|---|---|
| 1 | 0, 1 (a dot) | 0, 1, 0 |
| 2 | 0.5, 0.5 | 0.25, 0.5, 0.25 |
| 3 | 0.7, 0.3 | 0.35, 0.3, 0.35 |
| 4 | 0.8, 0.1, 0, 0.1 | 0.4, 0.1, 0, 0.1, 0.4 |
| 5 | 0.7, 0.1, 0.1, 0.1 | 0.35, 0.1, 0.1, 0.1, 0.35 |
| 6 | 0.5, 0.1, 0.1, 0.1, 0.1, 0.1 | 0.25, 0.1, 0.1, 0.1, 0.1, 0.1, 0.25 |
| 7 | 0.7, 0.1, 0, 0.1, 0, 0.1 | 0.35, 0.1, 0, 0.1, 0, 0.1, 0.35 |
| 8 | 0.5, 0.1, 0, 0.1, 0.1, 0.1, 0, 0.1 | 0.25, 0.1, 0, 0.1, 0.1, 0.1, 0, 0.1, 0.25 |
A zero length is a dot. An adaptive pattern is the fixed one split so that its first and last strokes are half as long, which is why a line that holds whole patterns starts and ends with a stroke.
UL index[,gap1,...,gapn] redefines type index (1 to 8; both its fixed and its adaptive form): the gaps are percentages of the pattern, the
first pen down, then alternately up and down, up to 20 values, scaled to add up to 100%. UL; restores all eight, and UL index; that one.
LA, PW and WU: line attributes and pen width
LA kind,value[,kind,value...]; with no parameters all three go back to their defaults.
| Kind | Value |
|---|---|
| 1 line ends | 1 butt (the default), 2 square, 3 triangular, 4 round |
| 2 line joins | 1 mitered (default), 2 mitered/beveled, 3 triangular, 4 round, 5 beveled, 6 none |
| 3 miter limit | 1 to 32767, the longest miter as a multiple of the pen width; default 5 |
PW width[,pen] sets the width of one pen or, without a pen number, of all of them: in millimetres (the default, 0.35 mm) with WU0, or as a
percentage of the P1 to P2 distance with WU1. PW; restores the default. Changing the width of stick-font labels with SI or SR
changes the width of the line used to draw them.
FT, RF, SV, AC and TR: fills
FT type[,option1[,option2]]; FT; is solid. Omitted options keep the values given before for that type.
| Type | Fill | Option 1 | Option 2 |
|---|---|---|---|
| 1, 2 | Solid (in the current pen) | ignored | ignored |
| 3 | Hatching: parallel lines | spacing, in current units along the X axis (0 or omitted: 1% of the P1 to P2 distance) | angle in degrees from the +X axis |
| 4 | Cross-hatching | spacing | angle; the second set of lines is 90 degrees further round |
| 10 | Shading | level, 0 to 100 percent | ignored |
| 11 | User-defined raster fill | the RF index, 1 to 8 (solid if none was defined) | ignored |
| 21 | PCL cross-hatch pattern | 1 to 6 | ignored |
| 22 | PCL user-defined pattern | the pattern ID of Esc*c#W | ignored |
Types 3 and 4 use the current pen, line type and line attributes: the end points of the hatching lines are drawn with the current line cap, and the
lines are not clipped to the polygon. The spacing keeps its plotter-unit value if scaling is turned off. Fill patterns start from the anchor corner, AC [x,y] (default 0,0 of
the picture frame).
RF index[,width,height,pen,...] defines one of eight small patterns: width and height are 1 to 255 pixels (one pixel is a dot of the printer’s
resolution), followed by width × height pen numbers from left to right and top to bottom (0 white, anything else black on a monochrome printer, a palette index
on a colour one); missing numbers are white. RF index; makes that pattern solid and RF; all of them.
SV type[,option1[,option2]] screens vectors (lines, hatch lines, arcs, circles, polygon edges): 0 none, 1 shading (option 1 the percentage), 2 user-defined
raster fill (option 1 the RF index, option 2 0 for pen 1 and 1 for the current pen), 21 PCL cross-hatch (1 to 6), 22 PCL user-defined pattern. SV; turns screening off.
TR n sets transparency: 1 (the default) the white parts of patterns and sources let what is underneath show through, 0 they are opaque.
SM char draws that character (codes 33 to 58 and 60 to 126; the semicolon cancels the mode) centred on every point of PA PD PE PR PU, with an
automatic pen down, restoring the pen position and the line pattern residue afterwards. SP pen selects a pen; SP0 or no parameter puts it away. In PCL the
drawing prints nothing until a pen is selected.
Spec and programs. FT 3 and FT 4 with a spacing of 0: GhostPCL (pglfill.c, hpgl_FT) takes 1% of the P1 to P2 diagonal when it fills, because the diagonal can change
after the FT; a negative spacing is a range error there. FT 10 with a level outside 0 to 100, FT 11 with an index outside 1 to 8, an option 2 other than 0 or 1, and FT 21 with a type outside 1 to 6 are
range errors there and leave the fill type as it was. For FT 11 the guide says option 2 chooses the colour of a pattern made of 1s and 0s (the current pen when 1, pen 1 when 0 or absent; ignored when the pattern uses other pen numbers);
GhostPCL’s comments say that it “varies from documentation” and that “contrary to the documentation, option 2 is used”, and the viewer follows the guide. Inkscape’s import (hpgl_input_sm.py: “Currently, only solid fill is supported”) fills every polygon solid in the pen colour whatever FT says. Its eight default
line types (percentages 0/100, 50/50, 70/30, 80/10/0/10, 70/10/10/10, 50/10/10/10/10/10, 70/10/0/10/0/10, 50/10/0/10/10/10/0/10) are the ones in the table above.
Polygons
PM 0 clears the polygon buffer and enters polygon mode; in it PD PU PA PR AA AR AT RT BZ BR CI EA ER EW PE add to the buffer instead of drawing (a pen-up move
starts a new sub-polygon; PM 1 closes the current one and stays in the mode; PM 2 closes it and leaves). EP edges the buffer’s sub-polygons with the pen;
FP [0|1] fills them with the current fill type, odd-even (0, the default) or non-zero winding (1). RA RR EA ER WG EW fill or edge a rectangle or
wedge without using the buffer. SP is not allowed in polygon mode.
The palette extension: NP, PC, CR
NP n resizes the palette (2 to 32768 entries), keeping existing entries. PC pen,c1,c2,c3 gives entry pen a colour, its three primaries clamped to the
range set by CR (default 0 to 255); PC pen; restores that entry and PC; the whole palette. CR br,wr,bg,wg,bb,wb sets the black and white reference of
each primary. The default palettes are:
| NP | Pen 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|---|---|
| 2 | white | black | ||||||
| 4 | white | black | red | green | ||||
| 8 | white | black | red | green | yellow | blue | magenta | cyan |
Larger palettes keep these first eight and are device dependent after. On a black and white printer pen 0 is white and the others black or, for
printers that take colours, equivalent grays. PC is ignored if the palette was made by the simple colour command. The viewer draws every
pen with the colour it is given.
Sources
- HP, PCL 5 Printer Language Technical Reference Manual, Part II (bpl13211), chapters 19 to 22 – instruction descriptions, parameter ranges, defaults, the LT and FT text
- HP, PCL 5 Color Technical Reference Manual (bpl13212), chapter 7 – NP, PC and CR and the default palettes
- GhostPDL pglfill.c – the line pattern percentages of the manual’s figure 22-17, which is a picture