PrintGL 1.40 HP-GL and ADI Commands (C) Copyright Ravitz Software Inc. 1990,1993 Ravitz Software Inc. BBS/FAX 606-268-0577 P.O. Box 25068 Lexington, KY 40524-5068 USA Compuserve Cary Ravitz [70431,32] Introduction ....................................................... 2 ADI Commands 2 HP-GL Commands ..................................................... 3 HP-GL Character Sets 13 p-2 Introduction --------------------------------------------------------- This document is a description of the subset of HP-GL (Hewlett-Packard Graphics Language) that is supported by PrintGL. If you are using PrintGL to work with commercial graphics software, then you will probably not need this manual. If you are writing HP-GL code you will find here the information needed to make your HP-GL compatible with PrintGL. ADI Commands --------------------------------------------------------- With the /YA option PrintGL can read Autodesk ADI 4.0 vector plotter binary commands intermixed in the HP-GL. 1016 dpi coordinates or the current HP-GL user coordinates are assumed. The table shows each ADI command and the equivalent HP-GL command (as interpreted by PrintGL). In the ADI code column, the code number and "b"s are bytes, and "x" and "y" are words. ADI command ADI code equivalent HP-GL begin plot 1 b ignored end plot 2 PG; move 3 x y PUx,y; (0 <= x,y <= 65535) draw 4 x y PDx,y; (0 <= x,y <= 65535) pen 5 b SPb; speed 6 b ignored line type 7 b if b=0 then LT; else LTb,2; raise pen 8 ignored abort 9 ignored Eight line types (other than solid) are supported. p-3 HP-GL Commands ------------------------------------------------------- PrintGL's HP-GL specification is taken from the programming manuals for the HP 7475A, ColorPro (7440/17440), and 7550A. The 7550 manual is the best reference for HP-GL - HP manual 07550-90001. PrintGL supports the 7475, and 7440/17440 command sets except for character set 8 (Katakana), digitize commands, output commands, the error mask command, and some device control commands. Supported commands are listed below. Commands that are not applicable to printing, such as pen velocity, are considered supported but are completely ignored. Commands that are not supported are flagged and then ignored. In addition, PG, AF, ES, LO, the enhanced IW command, character set 5, and proportional spaced fonts, from the 7550, are supported. And forty pens are allowed instead of eight. In reading a plotfile, PrintGL ignores carriage returns, line feeds, and nulls except where they may be valid characters (LB, SM, DT, esc.), and ASCII EOF (026) is interpreted as an end of file mark. AA x_center , y_center , arc_angle [, chord_angle] arc absolute AA moves the pen through an arc, starting at the current position, with the pen in the current up/down state. AF advance full page (7550 extension) AF starts a new plot. PrintGL starts every page with the pen up at 0,0. AP automatic pen pickup - IGNORED AR x_center_delta , y_center_delta , arc_angle [, chord_angle] arc relative AR moves the pen through an arc, starting at the current position, with the pen in the current up/down state. CA character_set designate alternate character set See HP-GL Character Sets for a list of character sets. CI radius [, chord_angle] circle CI draws a circle centered at the current position. The current up/down state and position are unchanged by a CI command. p-4 CP [spaces , lines] character plot CP moves the pen by character spaces (+ is along the text) and lines (+ is up), using the current up/down state. Using no parameters is the same as a carriage return/line feed. CS character_set designate standard character set See HP-GL Character Sets for a list of character sets. DF default values This sets default values for the following commands: CA, CS, DR, DT, ES, FT, IW, LO, LT, PA, PT, SC, SM, SL, SR, SS, TL. DI [run , rise] absolute character direction DI sets the baseline direction for labels. The default is 1,0. DR [run , rise] relative character direction DR sets the baseline direction for labels. Run and rise are a percentage of P2X-P1X and P2Y-P1Y. The default is 1,0. DTt define label terminator The label terminator ends an LB command. The default is ASCII 003. EA x_opposite_corner , y_opposite_corner edge rectangle absolute EA draws a rectangle defined by the current position and the parameters. The pen position and up/down state are unchanged. EC enable cutter - IGNORED EP edge polygon EP draws the current polygon edge. Any pen up/down used in creating the polygon is respected in drawing the edge. p-5 ER x_opposite_corner_delta , y_opposite_corner_delta edge rectangle relative ER draws a rectangle with corners defined by the current position and the command parameters. The current pen position and up/down state are unchanged. ES [ space [, line]] extra space (7550 extension) ES adds to the space between characters and lines. The units are in character cells (1.5*width, 2*height). The allowed range is -1 to 1. -.3333 causes characters to touch. EW radius , start_angle , sweep_angle [, chord_angle] edge wedge EW draws a wedge centered at the current position. The current pen position and up/down state are unchanged. FP fill polygon FP fills the current polygon. Pen up/down commands used in creating the polygon are ignored. There is a limit of 2000 fill line segments per polygon. FT [type [, spacing [, angle]]] fill type These are the fill types. Type 2 is identical to type 1 for PrintGL. 1 solid lines spaced at half the pen thickness (see PT command) 2 unidirectional solid lines spaced at half the pen thickness 3 lines at the specified spacing 4 cross hatched lines at the specified spacing 5 type ignored A spacing parameter of 0 sets the spacing to 1% of the P1-P2 diagonal. Spacing is in x axis units (this is only relevant if the axes have different scaling). PrintGL supports any integer angle for fill. Cross hatched lines are at angle + 90. IN initialize p-6 IP [p1x , p1y [, p2x , p2y]] sets scaling points P1 and P2 IP sets the scaling points (P1 and P2) in plotter units. P1 and P2 are used by several commands to help with size independent plots. IW [x_lower_left , y_lower_left , x_upper_right , y_upper_right] input window IW sets a clipping window in plotter units. With no parameters, the clipping window is turned off. If PrintGL's /YE switch is set and user scaling is on then IW parameters are in user units. In this case the window is rescaled with an IP command, but any SC command locks the current window. LB..text..terminator label Labels use the current character set, based on CA, CS, SA, and SS commands. See HP-GL Character Sets for font specifics. LO [ position_number ] label origin (7550 extension) LO sets the label origins, shown below. For positions 4..9 and 14..19 the label buffer is limited to 150 characters. The default is 1. 13 16 19 3...... ....... ...6... ....... ......9 . . . . . . . . . . 12 2 . . . . 5 . . . . 8 18 . . . . . . . . . . 1...... ....... ...4... ....... ......7 11 14 17 LT [pattern_number [, pattern_length]] line type PrintGL's line type patterns are close to, but not identical to HP's. Pattern length is a percentage of the P1-P2 diagonal with a default of 4% and a minimum of 4 dots for types 1 and 2 and 16 dots for other types. 1 ù ù no parameter solid 2 ÄÄÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄ 3 ÄÄÄÄÄÄÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄÄÄÄ 0 dots at 4 ÄÄÄÄÄÄÄÄÄÄÄÄ ù ÄÄÄÄÄÄÄÄÄÄÄÄ ù endpoints 5 ÄÄÄÄÄÄÄÄÄÄ ÄÄ ÄÄÄÄÄÄÄÄÄÄ ÄÄ only 6 ÄÄÄÄÄÄ ÄÄ ÄÄ ÄÄÄÄÄÄ ÄÄ ÄÄ 7 ÄÄÄÄÄÄÄÄÄÄ ù ù ÄÄÄÄÄÄÄÄÄÄ ù ù 8 ÄÄÄÄÄÄ ù ÄÄ ù ÄÄÄÄÄÄ ù ÄÄ ù p-7 PA [x , y] [, x , y] ... plot absolute PA sets absolute mode and optionally moves the pen in the current up/down state. PD [x , y] [, x , y] ... pen down PD sets the pen down and optionally moves it with the current absolute/relative mode. PG [i] new page (7550 extension) PG starts a new plot. The parameter is ignored. PrintGL starts every page with the pen up at 0,0. PM i polygon mode PM 0 starts polygon mode. The current position is the first point in the polygon. PM 1 starts a new subpolygon. The position after the next pen movement is the first point in the subpolygon. The first pen move of a subpolygon is done with the pen up, regardless of the current up/down status. PM 2 ends polygon mode. PM 1 and PM 2 close the current subpolygon with the current pen up/down state. If used without first starting polygon mode (PM 0), PrintGL adds an implied PM 0 before processing the PM 1 or PM 2. The following commands are accepted in polygon mode: PM, PA, PR, PU, PD, AA, AR, CI (circles are automatically prefixed and suffixed by PM 1), and IN (ends polygon mode). The polygon buffer is limited to 500 data points. PR [x_delta , y_delta] [, x_delta , y_delta] ... plot relative PR sets relative mode and optionally moves the pen in the current up/down state. PS paper size - IGNORED PrintGL ignores PS. The paper size must be set with the /L option. p-8 PT [thickness] pen thickness PT specifies twice the line spacing used in solid fills and may be from 0 to 5.0 mm. It is reset to .3 mm with each SP command. PU [x,y] [,x,y] ... pen up PU raises the pen and optionally moves it with the current absolute/relative mode. RA x_opposite_corner , y_opposite_corner shade rectangle absolute RA fills a rectangle with corners defined by the current position and the command parameters. The current pen position and up/down state are unchanged. The rectangle edge is not drawn. RO [angle] rotated coordinate system RO or RO0 sets up a normal coordinate system. RO90, the only other allowed value, sets up a system that is rotated 90 degrees. The type of rotation depends on the paper size. This command does not change the scaling points, so an IP command is useful after an RO. The HP 7475 specifies two different meanings for RO90 depending on the paper size (A/A4 or B/A3). PrintGL decides which type of rotation to do based on the sum of the print window width and height. If this sum is greater than 24 inches then large paper rotation is used. Otherwise, small paper rotation is used. Small paper rotation: Large paper rotation: RO 0 RO 90 RO 0 RO 90 yÚÄÄÄÄÄÄÄÄ¿ 0,0ÚÄÄÄÄÄÄÄÄ¿y 0,0ÚÄÄÄÄÄÄÄÄ¿y yÚÄÄÄÄÄÄÄÄ¿ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ 0,0ÀÄÄÄÄÄÄÄÄÙx xÀÄÄÄÄÄÄÄÄÙ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ xÀÄÄÄÄÄÄÄÄÙ 0,0ÀÄÄÄÄÄÄÄÄÙx RR x_opposite_corner_delta , y_opposite_corner_delta shade rectangle relative RR fills a rectangle with corners defined by the current position and the command parameters. The current pen position and up/down state are unchanged. The rectangle edge is not drawn. p-9 SA select alternate character set SA specifies the alternate character set as current. The alternate character set is chosen with CA. SC [xmin , xmax , ymin , ymax] scaling SC sets user units for subsequent drawing. The units are defined by user values for P1 (xmin,ymin) and P2 (xmax,ymax). Using no parameters turns scaling off, and subsequent drawing is done in plotter units (1/1016 inch). SI [width , height] character size absolute SI sets the capital letter box width and height in centimeters. Letter spacing is 1.5 * width and line spacing is 2 * height. Using no parameters with B or A3 paper is the same as SI.285,.375 and any other paper is the same as SI.187,.269. SL [tan_angle] character slant SL sets the character slant. The parameter is interpreted as the tangent of the angle from vertical. Using no parameter sets the slant to 0 degrees. SM[c] symbol mode SM sets symbol mode, which centers the symbol mode character at any plotted point. Any character from ASCII 033 to 127 except ";" sets symbol mode. Any other character turns symbol mode off. SP pen_number select pen SP selects a pen. Using 0 or no parameter stores the pen without selecting a new pen. This is usually done at the end of a plot. PrintGL ignores any drawing with pen 0. SR [width , height] character size relative SR sets the capital letter box width and height as a percentage of P2X-P1X and P2Y-P1Y. Letter spacing is 1.5 * width and line spacing is 2 * height. Using no parameters is the same as SR.75,1.5. p-10 SS select standard character set SS specifies the standard character set as current. The standard character set is chosen with CS. TL [positive_length [, negative length]] tick length TL sets the tick lengths used by XT and YT. The parameters are lengths above and below the current position as a percentage of P2Y-P1Y for x-axis ticks and a percentage of P2X-P1X for y-axis ticks. UC [[pen_control ,] x_delta , y_delta] ... user character UC specifies a user defined character. The pen control number is 99 for pen down or -99 for pen up. Pen movements are relative, with x_delta in units of 1/4 the character width and y_delta in units of 1/8 the character height. VA adaptive velocity - IGNORED VN normal velocity - IGNORED VS pen velocity - IGNORED WG radius , start_angle , sweep_angle [, chord_angle] shade wedge WG fills a wedge centered at the current position. The current pen position and up/down state are unchanged. The wedge edge is not drawn. XT x-axis tick XT draws a vertical line, with length specified by the TL command, at the current position. The pen position and up/down state are unchanged. p-11 YT y-axis tick YT draws a horizontal line, with length specified by the TL command, at the current position. The pen position and up/down state are unchanged. esc.( esc.Y plotter on Esc.( and esc.Y turn the plotter on. This is only relevant with the /YY option. esc.) esc.Z plotter off Esc.) and esc.Z turn the plotter off. They are only effective with the /YY option. The plotter on and off commands let you include comments or data to pass through to another device in the plotfile. These are flagged as unsupported commands if /YD is set, as an indication that you should set /YY. esc.@, esc.H, esc.I, esc.M, esc.N, esc.R RS-232 device control commands - IGNORED p-12 HP-GL Character Sets ------------------------------------------------- PrintGL supports all of the character sets that are included with the HP 7475 and 7440/17440 except Katakana, and adds character set 5 and the proportional spaced fonts from the 7550. PrintGL's characters are similar to but not identical to HP's. 0 ANSI ASCII 1 9825 character set 2 French/German 3 Scandinavian 4 Spanish/Latin American 5 Special Symbols (7550 extension) 6 JIS ASCII 7 Roman Extensions 8 Katakana - NOT SUPPORTED BY PRINTGL 9 ISO IRV (International Reference Version) 30 ISO Swedish 31 ISO Swedish For Names 32 ISO Norway Version 1 33 ISO German 34 ISO French 35 ISO United Kingdom 36 ISO Italian 37 ISO Spanish 38 ISO Portuguese 39 ISO Norway Version 2 The character sets specify a font for codes 033..127. Codes 000..032 and 128..255 are independent of the character set and are all no ops except these. 003 default label terminator 008 backspace 009 half backspace 010 line feed 011 reverse line feed 013 carriage return 014 select alternate character set 015 select standard character set 032 space Each of the character sets is available as a proportional font by adding 10 to the set number. The proportional fonts are kerned to improve appearance (the character spacing is adjusted to compensate for character shape). Use the LO command to simplify working with proportional fonts. To improve the appearance of large text, use the ES command to reduce the character spacing. Codes 65 to 81 in character set 5 are symbols designed to be used in symbol mode (SM command) or as one character labels. When used in a label (LB command) these characters are centered at the current pen position and leave the pen position unchanged. p-13 The HP-GL characters cannot be printed with the standard ASCII character set. The file HPGL.CHR is an HP-GL file that can be used to print a replacement for this page, showing the character sets. Use the command PRINTGL HPGL.CHR /M1 /AO0,0 with a /F option specific to your printer to do this.