×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How to alter line width in PostScript Driver Prologue?

How to alter line width in PostScript Driver Prologue?

How to alter line width in PostScript Driver Prologue?

(OP)
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?

RE: How to alter line width in PostScript Driver Prologue?

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
http://www.tgreer.com

Providing PostScript & PDF
Training, Development & Consulting

RE: How to alter line width in PostScript Driver Prologue?

(OP)
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


RE: How to alter line width in PostScript Driver Prologue?

(OP)
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.

RE: How to alter line width in PostScript Driver Prologue?

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
http://www.tgreer.com

Providing PostScript & PDF
Training, Development & Consulting

RE: How to alter line width in PostScript Driver Prologue?

(OP)
Thank you very much for the code.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close