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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to alter line width in PostScript Driver Prologue?

Status
Not open for further replies.

Nasispo

Technical User
Dec 6, 2004
4
0
0
CA
I'm in a group that does academic, critical-edition work with in-house typesetting in WordPerfect 5.1. We always use a PostScript printer driver. As output resolutions have increased and WP 5.1 hasn't been updated since 1994 (really 1992), what are called single lines in WP menus now print extremely thinly -- hairlines, really. They even disappear on some proofing outputs. I want to thicken WP's single line and incidentally extend the useful life of this grand old wordprocessing/typesetting program. Its other line options are not appropriate to our typesetting design.

The readymade single line shows up in table and box borders, and in equations. It's also possible to create a line of user-specified thickness.

I've checked the Prologue as revealed in the Printer (Editing) Program provided with WP. The Prologue is also available in a .PS file in preparation for distilling a .PDF file. I believe the command that governs the thickness of the single line is "num setlinewidth". It occurs 7 times in the Prologue. I've tried altering them, rather randomly, but Adobe Acrobat Distiller stops its processing of the file due to a "PostScript error" and flushes the job. If I had the right code, I'd alter the driver Prologue's line width(s) through the Printer Program.

I want to ask this forum how to get a thicker single line from WP 5.1 and feel that I should provide you with some code from the Prologue or the .PS. However, both files are lengthy, even the latter after the Prologue ends. My prequestion is: what should I excerpt?
 
setlinewidth is indeed the proper operator.

The problem is that "0 setlinewidth" means "print the thinnest line possible".

In the day of 300 dpi printers, this was indeed a visible line. On a 2400 dpi typesetter, it's invisible.

You need to find that case where the driver or the PPD produces "0 setlinewidth" and instead pass it a real number.



Thomas D. Greer

Providing PostScript & PDF
Training, Development & Consulting
 
Thank you for suggestion. I can't find "0 setlinewidth" but instead have found these sections in the driver Prologue with "setlinewidth". Some of them look irrelevant, but surely something can be inserted or altered here to set a new single line thickness:

/_du {gsave
save
8 setlinewidth
currentpoint -30 add _mt
DUx DUy -30 add _lt stroke
restore
8 setlinewidth
currentpoint -50 add _mt
DUx DUy -50 add _lt stroke
grestore
} bdef

/_rshow { save exch
currentpoint
/RSy exch def /RSx exch def
ron {
sflg
{ currentpoint
/Ry exch def /Rx exch def
dup stringwidth pop Rx Ry psz 4 div add _mt
Rx psz 15 add setlinewidth .95 setgray 0 setlinecap
add Ry psz 4 div add _lt stroke Rx Ry _mt 0 0 0 setrgbcolor
dup show Rx Ry _mt
sshow
}
{ _redshow
}ifelse
}
{ sflg {sshow} if
}ifelse
currentpoint 3 -1 roll
restore _mt
} bdef

/_red { gsave dup
currentpoint /Ry exch def /Rx exch def
Rx Ry psz 4 div add _mt
Rx psz 15 add setlinewidth .95 setgray 0 setlinecap
add Ry psz 4 div add _lt stroke
Rx Ry _mt
grestore
0 rmoveto
}bdef

/_redshow {currentpoint
/Ry exch def /Rx exch def
dup stringwidth pop Rx Ry psz 4 div add _mt
Rx psz 15 add setlinewidth .95 setgray 0 setlinecap
add Ry psz 4 div add _lt stroke Rx Ry _mt 0 0 0 setrgbcolor
show currentpoint _mt
}bdef

/_u {gsave
currentpoint
-30 add _mt
Ux Uy -30 add _lt
12 setlinewidth
stroke
grestore
} bdef
/_w /setlinewidth load def

 
WordPerfect 5.1's separate Printer Program allows you to view the printer commands associated with a given driver, in this case a source file for PostScript drivers. The commands are grouped under functions. The function "Initialize at Start of Print Job" is matched to the expression "prologue autocopy fftype:=1". That expression can be expanded as a "global string variable" and output to a file. I did that. Then I selected sections of the prologue that contained "setlinewidth".

The prologue and other variables can be edited in the Printer Program. Possibly setlinewidth could be added there, but then I'd expect use of it to show up in the print job somewhere.

WP itself also allows for separate printer command files to be downloaded to the printer with a print job. Our unit does that successfully. Unfortunately, the creator of those PS-language files long ago moved on. But maybe a separate command file is what's needed to overcome a setting somewhere in the driver or its source file.
 
Ok. Thank you for your very detailed posts.

Overload the setlinewidth operator in your Prolog. What you do is make your own defintion of setlinewidth. It will take precedence over the system setlinewidth.

Code:
/sys_setlinewidth /setlinewidth load def
/setlinewidth
{ dup 0 eq
  { pop 1
  } if
  sys_setlinewidth
}

What that code does is "store" the system setlinewidth into a new definition, sys_setlinewidth.

It then defines a new setlinewidth, as a procedure. The procedure compares the number on the stack with 0. If it is zero, it throws it away and replaces it with "1". Make that any value you like, if "1" is still too thin.

It then performs the "real" setlinewidth.

If you place this code in your prolog, it should override the default behavior of setlinewidth wherever it occurs.



Thomas D. Greer

Providing PostScript & PDF
Training, Development & Consulting
 
Thank you very much for the code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top