home *** CD-ROM | disk | FTP | other *** search
- The LASERPRT.PAS file produces a unit which is used for
- printing reports with a HP LaserJet or compatible printer.
- Most of the commonly used formatting commands have been
- provided as functions. Each function returns a string
- containing the appropriate HP PCL control codes. It is
- anticipated that the function calls would be made within a
- "WRITE(lst," or a "WRITELN(lst," statement.
-
- One of the most difficult problems I had in trying to format
- my printouts was using the shading feature to shade every
- other line. Ted Dickens, Sysop of the HP Forum (76701,272)
- figured out the right way to accomplish this task. The
- following is an edited version of several messages he wrote
- explaining how this is accomplished. In addition, the
- sample program included in the LZRTPU.ZIP file
- (SHADETXT.PAS) was originally written by Ted to demonstrate
- this procedure. I have modified it to take advantage of the
- LASERPRT.TPU functions.
-
- ============================================================
- There are three different ways to position the cursor on a
- LaserJet+ (or later): row/col, dot/dot, and
- decipoint/decipoint. The three are not interchangeable.
-
- For the sake of this discussion, assume the top margin is 0
- lines and that the left unprintable margin is 0.25 inches.
-
- The decipoint/decipoint control sequence, <esc>&a720v1440H,
- says move the cursor to 1" (720/720) from the top edge and
- 2.25" (1440/720 + 0.25" unprintable region) from the left
- edge.
-
- The dot/dot control sequence, <esc>*p300y600X, does exactly
- the same thing. With either command, the cursor will be
- positioned exactly 1" from the top of the paper and 2.25"
- from the left edge. If you were to draw a single dot --
- that's where it would appear.
-
- But, even though there are 10 characters per inch and 6 rows
- per inch, the row/col control sequence, <esc>&a6r20C, will
- NOT leave the cursor at the same position.
-
- The cursor WILL be left 2.25" from the left edge. But the
- vertical spacing will be at 6.75 rows from the top -- not 6
- as one might think.
-
- There's a pretty good reason for this. Think of a character
- cell:
- +-------+
- | |
- | |
- | | /______ Baseline is set to 75%
- | | \ of the current VMI setting
- +-------+
-
- This little extra nudge moves the cursor so that the top of
- the character cell will fall at the specified location. In
- this example -- the TOP of the first character we print
- should appear 1" from the top edge and 2.25" from the left
- edge.
-
- In fact, the only time that the difference is even noticed
- is when mixing text and graphics. (Shading is a graphic
- function on the LaserJets.)
-
- Therefore, when shading a line of text, the shading
- procedure should:
-
- 1. move the cursor up 75 percent of the height of the
- current line height;
-
- 2. fill the desired area;
-
- 3. move the cursor down 75 percent of the height of the
- current line height;
-
- 4. print the line of text.
-
- Thus, the up and down cursor movements are:
-
- Line Height Movement
- lpi (decipoints) (decipoints)
- --------- ------------ ------------
- 4 180 135
- 6 120 90
- 8 90 67.5
-
- (line height = (1 inch/X lpi)*(720 decipoints per inch)
- ============================================================
-
- The principles discussed above are used in three sample
- programs. The first (SHADETXT.PAS) is included in the
- LZRTPU.ZIP file. The other two (SHADE1.PAS and SHADE2.PAS)
- are available in Library 0 of the HP forum. SHADETXT.PAS is
- a sample program showing alternating lines of shaded text.
- SHADE1.PAS produces a pattern similar to "green bar" paper
- in the portrait format while SHADE2.PAS does the same thing
- except in the landscape format.
-
- By the way, if you browse the HP library, you will see a
- SHADE3.PAS file. That is the original version of the
- SHADETXT.PAS program.
-
-