The character group is the largest of the HP-GL/2 groups. This page gives its details, from HP’s PCL 5 Printer Language Technical Reference
Manual, Part II, chapter 23 (the pages for DT, LO, SA, SI, SR and the defaults table were read for this page) and the
quick reference in the PCL 5 Comparison Guide.
LB and its terminator
LB text<terminator> draws everything after it up to the label terminator, which is ETX (code 3) unless DT changes it; it is not a semicolon. The
terminator ends the instruction, so no semicolon follows it. DT char[,mode] takes the character straight after DT (a space after DT is a
valid terminator) as the new terminator, which cannot be NULL, LF, Esc or a semicolon (the manual gives their codes as 0, 5, 27 and 59); mode 1 (the default) means a printing terminator is not
printed and a control-code terminator does not act; mode 0 means it is. DT; restores ETX and mode 1.
Control codes inside a label act as in PCL: CR returns to the label’s starting point (the Carriage Return point, which LB, LO and DF update to the pen position),
LF moves a line (against the text path), BS backs up, and Shift Out (14) and Shift In (15) switch to the alternate and standard font. TD 1 turns this off so that control codes are drawn as characters.
CP spaces,lines moves the pen by whole character cells without drawing, and with no parameters does a carriage return and line feed.
Character size, slant, direction and spacing
| Instruction | Meaning |
|---|---|
SI width,height | The width of the nominal character and the capital height, in centimetres (−32768 to 32767). A negative width mirrors labels right to left and a negative height top to bottom. Without parameters the size comes from the font again. While SI is in effect the size does not change with P1 and P2. |
SR width,height | The same as percentages: width as % of P2x − P1x, height as % of P2y − P1y. Defaults 0.75% and 1.5%. While SR is in effect the size follows P1 and P2. |
SL tangent | The tangent of the slant from the vertical; 0 is upright. |
DI run,rise | The direction of the baseline as the cosine and sine of its angle, independent of P1 and P2; DI; is 1,0. |
DR run,rise | The same as percentages of the P1 to P2 distances, so it follows P1 and P2. |
DV path[,line] | The text path: 0 right (0 degrees), 1 down (−90), 2 left (−180), 3 up (−270); and the line direction: 0 normal line feed, 1 reversed. The label origin does not change the text path. |
ES width[,height] | Extra space between characters, in character widths, and between lines, in character heights (fractions allowed, negative to tighten). |
LO: label origin
LO position says which point of the label sits at the pen position. Positions 1 to 9 number the nine places of the label’s box, in columns from the left and from
bottom to top within each column: 1 left bottom, 2 left middle, 3 left top, 4 centre bottom, 5 centre middle, 6 centre top, 7 right bottom, 8 right middle, 9 right top.
11 to 19 are the same places but offset from the pen position, and 21 is the PCL-compatible origin: the characters print where PCL would print them.
The default is 1, and LO; is LO1.
Two LBs run on from each other (the pen ends where the first label ended) only for these combinations of text path and origin; otherwise the pen goes back to where it was before the label:
| Text path | Origins that concatenate |
|---|---|
| DV0 (right) | 1, 2, 3, 11, 12, 13, 21 |
| DV1 (down) | 3, 6, 9, 13, 16, 19 |
| DV2 (left) | 7, 8, 9, 17, 18, 19 |
| DV3 (up) | 1, 4, 7, 11, 14, 17, 21 |
The standard and alternate fonts
HP-GL/2 has two fonts at a time. SD kind,value,... describes the standard font and AD the alternate font with the same kinds; SS (or Shift In inside a label)
selects the standard and SA (or Shift Out) the alternate. After IN or DF both are the stick font, 11.5 point, 9 characters per inch, upright, medium.
| Kind | Attribute | Values |
|---|---|---|
| 1 | Symbol set | as PCL’s symbol set value (see symbol sets) |
| 2 | Spacing | 0 fixed, 1 proportional |
| 3 | Pitch | characters per inch |
| 4 | Height | points |
| 5 | Posture | 0 upright, 1 italic |
| 6 | Stroke weight | 0 medium, 3 bold, and the other values of PCL’s stroke weight |
| 7 | Typeface | as PCL’s typeface number |
FI id and FN id select as the primary and secondary font a font that PCL gave an ID with Esc*c#D (the dual-context extension). SB 0 uses scalable fonts only (the default) and
SB 1 bitmap fonts too (an SI size then picks the nearest bitmap, by height for proportional and by width for fixed-pitch fonts, and negative sizes cannot mirror).
CF mode[,pen] chooses how outline characters are painted: 0 solid fill and edged, 1 edged with the pen, 2 filled with the current fill type, 3 filled and edged. LM mode[,row] sets how bytes are read: 0 as
8-bit characters, 1 as 16-bit characters (two bytes each), 2 and 3 the same with vertical substitutes from the font’s VT segment; row is the first byte of a 16-bit character in mode 0 when a 16-bit set is selected.
In the viewer
The drafting typeface 49 is drawn with font 7 of the HP 7596A plotter firmware and the labels of an original HP-GL file (one with no HP-GL/2-only instruction) with its font 1, as the Divergence section of the plt page explains. Labels in the stick font (typeface 48) and the fixed and variable arc fonts (typeface 50; spacing 1 makes it variable) are drawn from the vector data of GhostPDL (see Licences), placed from the character size, slant, direction, text path, extra space and label origin above. The data are on a grid 1024 units wide for the character cell, indexed by Roman-8 code from 32; the stick font’s capitals are 992 units tall and its glyphs up to 672 wide, two thirds of the cell, as the guide’s “32 units of a 48-unit cell” says. Spec says the arc font is proportionally spaced; the data give each character’s width. Bitmap, scalable and 16-bit fonts and the printer’s own fonts are listed and explained but a label is always drawn in these vector fonts.
Spec and programs. The guide: the stick font’s main body fits a 32-by-32-unit box with descenders below, and it is fixed spaced; the guide’s only figure of a stick glyph is one “A” (Figure 44). GhostPCL
(pgfont.c, pglabel.c, pgfdata.c) holds the shapes of every character of Roman-8 for the stick and the arc font, selects them only by typeface 48 or 50 (STICK_FONT_TYPEFACE and the arc
typeface) and gives typeface 49 no data of its own (the viewer takes it from the firmware); its stick font “is defined in a cell that’s only 2/3 the size of the actual character”. The viewer follows GhostPCL for the shapes and the guide for everything else. Codes
above 127 in a symbol set other than ASCII or Roman-8 are drawn as the Roman-8 character of the same code (the symbol set tables are not applied to labels).
Character selection modes (CM)
Original HP-GL (7580B family, 7580B, 7585B and 7586B Interfacing and Programming Manual, chapter 7 “Labeling Plots”, pages 7-49 to 7-60, read from the page images of the archive.org scan) maps each byte of a label through an in-use code table: a left half GL (bytes 33 to 126) and, in the 8-bit modes, a right half GR (161 to 254), each pointing at one of four slots G0 to G3, which hold character sets. DS slot,set fills a slot (CS and CA are DS0 and DS1), IV slot[,left], SS, SA, shift-in (15) and shift-out (14) choose the slot that GL or GR uses. CM mode[,fallback] picks the rules; a CM that changes the mode resets the slots to G0 = G1 = set 0, G2 = G3 = set 7, GL to G0 and, in ISO 8-bit mode, GR to G1.
| CM | Mode | What a byte does |
|---|---|---|
| 0 | HP 7-bit (default) | the eighth bit is cleared; only G0 (standard) and G1 (alternate) exist; every set is a 128-code singlet in GL |
| 1 | HP 8-bit | bytes 33 to 126 are GL, 161 to 254 are GR; GR is linked to GL: ANSI ASCII (set 0) pairs with the Roman Extensions (set 7) and JIS ASCII (set 6) with Katakana (set 8); any other set is a singlet whose right half is undefined; G2 and G3 cannot be used |
| 2 | ISO 2022.2 7-bit | the eighth bit is cleared; GL can invoke any of G0 to G3 (IV, SS, SA, shift-in, shift-out); the second IV parameter is ignored |
| 3 | ISO 2022.2 8-bit | GL and GR each take any slot (IV slot,0 into GL, IV slot,1 into GR; GR is G1 by default); byte 142 (SS2) and 143 (SS3) take G2 or G3 for the next character only |
In all modes bytes 127, 128 to 160 and 255 are control codes: backspace, line feed, carriage return, shift-in and shift-out act, VT (11) is an inverse line feed and HT (9) a half backspace, every other control code is ignored. The fallback mode (second CM parameter) concerns undefined printable codes (blank cells of the Katakana and Roman Extension sets, the right half a singlet lacks, empty cells of the downloadable set): 0 ignores them, 1 draws a box. Only the escape sequences of ISO 2022 are not implemented in the plotter (the manual’s note on 7-49).
In the viewer. Everything above is applied once a CM has run; before that, bytes above 126 are Roman-8 codes as in HP-GL/2. Three readings are the viewer’s: the manual says that for a singlet “its left half” is undefined in HP 8-bit mode, which cannot be meant (a singlet’s defined half is the left one), so the right half is taken as undefined; the manual’s HP 8-bit figure gives no default for a slot in GR other than set 7 against set 0, so a slot designated by DS in that mode follows the pairing rule above; and the size of the fallback box is not given (the viewer draws a box as high as a capital and 0.8 of a cell wide). No plotter output of these modes, nor any program that implements them, was found to compare; GhostPCL implements none of them (it has no CM entry). The figures were legible in the scan: the default GR slot of ISO 8-bit mode is not drawn in the figure but the page of IV says “for the ISO 8-bit mode, G1 is invoked into GR”.
Sources
- HP, PCL 5 Printer Language Technical Reference Manual, Part II (bpl13211), chapter 23 and the default-values table of chapter 19
- HP, PCL/PJL Reference Set: PCL 5 Printer Language Technical Quick Reference Guide (bpl13205) – the character group summary
- HP, 7580B, 7585B and 7586B Interfacing and Programming Manual (archive.org item hp-7580-b-7585-b-7586-b-interface-programming), chapter 7, pages 7-49 to 7-60 – CM, DS, IV, SS, SA and the fallback mode