Clipper PCL Guide    Home

You can select fonts numerous different ways, as long as you understand the limitations of the particular printer you're using.  Do this by telling the printer whether you are using fixed-space or proportional fonts, how many characters per inch (for fixed-space) or what point size (proportional), what typeface to use, what symbol set to use, and what special attributes (bold, underline, italic) to use.  You can specify all or some of those traits, and any you do not specify will allow the printer to pick the font that most closely matches your specifications.

Nearly all PCL commands begin with chr(27) for the ESCape code; you'll probably want to #define a manifest constant
so you can just write ESC + "whatever" rather than keep writing CHR(27)+"whatever" millions of times.

For most reports, you'll want to use fixed-space characters so that all the columns will line up straight.  To select that
type style, give this command:
ESC + "(s0P"

If you expect to need the standard ASCII characters for
drawing lines around text (which isn't really necessary
since you can draw graphic lines, but if you want a page
output that matches screen output, you'll need this) it
also helps to specify the "PC-8" symbol set, which is
ESC + "(10U"

Then, to give a type size in characters per inch, use this command:
ESC + "(s10H"
10H is 10 CPI; for condensed you can go up to 17H (actually
it's 16.66, but you can just say 17 and the HP will find the
nearest match).

Most of my reports, then, use this printer initialization sequence:
ESC + "(10U" + ESC + "(s0p10H"

What, you may ask, is that 0p10H business?  You can combine
commands that share a common beginning sequence, in this
case the ESC + "(s" set of commands.  All commands used
this way should end in a lowercase final letter, except for the
LAST command in the shared group which ends in uppercase.

Clear as mud?  These two commands are identical:
ESC + "(s0P" + ESC + "(s10H"
ESC + "(s0p10H"

In the first example, ESC(s0P is the whole command, so the
final P terminates the command.  In the second example, the
0p and 10H share the ESC(s at the beginning, so you use a
lowercase p to tell the printer "Wait, I have another ESC(s
command for you".  Then the 10H uses the capital H to
say "OK, the ESC(s sequence is finished."

To get this information to the printer, you just send it the same
way you'd send any text data - with the ?? command:

cPrnInit := ESC + "(10U" + ESC + "(s0p10H"
set printer to LPT1
set printer on
?? cPrnInit
PrintTheRestOfMyReport()
?? chr(12)
set printer to
set printer off


Meanwhile, other possibilities to consider are downloading soft
fonts and even manipulating character sets to create your own
fonts.

PageScript (at www.abeelabs.com) and picked up a great library
that does all the work for me... plus has the advantage
of working with Windows-only printers through the
miracle of a Clipper/Windows hybrid driver. 

Home