2001/10/02
CHAPTER 4 HP-GL/2 - 46
• When you use an LO instruction the carriage return point is set to be the new label origin. To send the pen
back to a label's origin when you have finished printing it, include a carriage return between the last character
of the label and the terminating character.
• If a label contains embedded carriage returns, each character string following a carriage return is printed
starting from the label origin.
• If you omit the parameter the label origin is the bottom left hand corner of the first character's character cell -
equivalent to LO11;.
• The command remains in effect until the printer is initialized with an IN command, until the default
conditions are restored with the DF command or until another LO command is used.
10 '-Label Origin-
20 WIDTH "LPT1:", 255
30 LPRINT CHR$(27); "E";
40 LPRINT CHR$(27); "%0B";
50 LPRINT "IN;SP;";
60 LPRINT "SC-4000,4000,-5000,5000;SI0.17,0.26;"
70 LPRINT "PA0,500;PD-500,0,0,-500,500,0,0,500;DT#;"
80 LPRINT "CI10;LO4;LBCentred on point#"
90 LPRINT "PU-500,0;CI10;LO18;LBleft centre offset#"
100 LPRINT "PU0,-500;CI10;LO13;LBRight offset from point#"
110 LPRINT "PA500,0;CI10;LO3;LBright hang from point#"
120 LPRINT CHR$(27); "%0A";
130 LPRINT CHR$(27); "E";
140 END
<Sample 53>
DI - Absolute direction
DI [ run, rise ] [;]
run : X direction component rise : Y direction component
• This command determines the direction in which subsequent labels will be printed.
•
rise
run
gives the tangent of the angle between the base line of a label's characters and the horizontal.
• run is equivalent to cos θ and rise is equivalent to sin θ.
θ
run
rise
tan
θ=
cos
sin
θ
θ
• Values for run and rise are clamped real numbers.
• When you issue a DI instruction the carriage return point is set to the current pen location.
• The instruction is ignored if run and rise are both 0.
• Any text path that you set with the DV instruction will combine with the current printing direction to
determine the layout of characters on the page.
• If you omit the parameters the printing direction is horizontal.
• The label direction which is specified by this command is not affected by changes in the location of P1 and
P2.
10 ' -Absolute Direction -
20 WIDTH "LPT1:", 255
30 LPRINT CHR$(27); "E";
40 LPRINT CHR$(27); "%0B";
50 LPRINT "IN;SP1;";
60 DEG = -45
70 RAD = 3.1416 / 180 * DEG
80 LPRINT "IN;SP2;PA3050,4450;"