Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gmmastros on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a scalable fixed-space font

Status
Not open for further replies.

msc0tt

IS-IT--Management
Jun 25, 2002
281
0
0
CA
I've been playing with PCL codes in an effort to set my printer to a scaleable, fixed-space font (i.e. Courier). Here's my current try:

{ESC}E (reset)
{ESC}l0O (portrait)
{ESC}(8U (Roman-8 symbol set)
{ESC}(s0p37v4099T Test (Courier at 37 pts)

I get "Test", but at the lowly 10cpi.

If I change the 0p to 1p in the last command, I get my 37-point "Test", but NOT fixed-spaced characters -drat!

All help appreciated!
 
You don't set the size of a fixed pitch font with the point size. That is for proportional fonts. Change the pitch which is measured is cpi. For example...

<esc>(s5H

will give you 5 characters per inch, equal to about 24pt. Note that the letter gothic font has a much taller aspect ratio than courier, so at any given pitch you will get taller characters. Jim Asman
jlasman@telus.net
 
Jim,
Thanks for the tip. Yep, I can now control the size of the font, but there is an unexpected side-effect. My lines overlap!! I just assumed that when changing the cpi of the font, the printer would &quot;clue in&quot; and adjust the LPI accordingly -NOT!
Is it up to me to &quot;math out&quot; what the appropriate LPI should be? And if so, what is the standard formula?
Mike.
 
Usually a linespacing of 120% of the point size is considered appropriate. But of course that is just a rule of thumb and is also dependent on the actual character heights of the specific font. Really, you don't want the printer to make those decisions for you.

If you go from 10 cpi to 5 cpi, the you can either change the line spacing or only put text on every other line. If you are only printing a few words in the large font, then I would rely upon stragic placement of the text rather than a change in spacing.
Jim Asman
jlasman@telus.net
 
Jim,
To set the VMI (<esc>&l<nnn>C), your ratio 120% of point size sounds good... but since I have to specify my font size in cpi (fixed-pitch font), not points, how can I determine the point size of a given font at a specific cpi? (e.g. Courier @ 13.5cpi ?)
-thanks, Mike.
 
While I haven't thought it through, a little algebra should tell you what you need. Say 10 pitch = 12 points.

Then...

new point size = (10/13.5) * 12

Honestly, I think you are making a bigger deal over this than you need to. Try to standardize on 6 or 8 lpi or some multiple.

You could set your line spacing to 12 or 24 lpi and only populate the appropriate lines. That can actually be a very useful technique to more accurately position text on a form, in the situation where you don't want to specify the precise x,y coordinates.

Jim Asman
jlasman@telus.net
 
What I pain I am!! ;-{)
The answer I'm after isn't surfacing, so I suspect there is no answer! (clearly, you know your PCL, which I greatly appreciate).

Here is the 'fuller picture' of my situation:
-We have a basic reporting utility on our Oracle server.
-The reports are always 'plain text', with formatting that assumes a fixed-space font.
-The report printers are all HP LJ4 (or better).
-Currently, the reports are sent to the printer 'as is' which provides an 80-col, by 60-row printed page.
-Staff regularily ask for more printed columns on their reports.

What I am trying to do is write a simple macro (within our reporting utility), that takes a single parameter CPI. This parameter could range from 1-20. For example:

setPrinterCPI(15);
dumpReport();

The macro would send the PCL codes to the printer immediately before sending the text report. With this single number (i.e. 15), the macro would setup the page (easy), set the font (easy), set the CPI (easy), and set the correct line spacing for that specific font/CPI (HARD). What I didn't want to do was hard code a line spacing setting for every possible CPI. What I also didn't want to do was have only a few CPI choices such as 10, 12, 17 (again, all hardcoded).
I will try out your formula: &quot;pts = (10/cpi) * 12&quot; with all the CPIs between 1 and 20, and see what the printed results look like. (fingers crossed).
-Mike
 
I still think you are over engineering the process. I just went through formatting 100+ output formats for a customer that was going from a dot matrix with 15&quot; fanfold to a LaserJet/InkJet environment. Some formats as wide as 235 chars.

I would set any 12pitch or greater requirement to 8 lpi.

Do a test and physically measure the character heights and different pitches and settle on maybe 4 different layouts.

If you are expecting page breaks at particular spots in the document, then that has to be considered as well.

The practicalites of courier much under 10 cpi aren't too great.
Jim Asman
jlasman@telus.net
 
The rule of thumb that 'pitch x pointsize = 120' usually holds good for the Courier typeface, but for Letter Gothic (having a different aspect ratio) a better factor is 144.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top