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

Text-wrapping in PostScript?

Status
Not open for further replies.

makaveliuk

Programmer
Joined
Dec 1, 2003
Messages
46
Location
GB
I am working on a project to create postscript from a data file, it's working ok for adding images and single-lines of text but I cannot work out how to make text wrap, is it possible?
 
Of course it is possible. But there isn't an automatic operator for it. You have to program it.

The technique is to keep track of the currentpoint as text is displayed. Once it reaches a certain point, you must set a new currentpoint.



Thomas D. Greer

Providing PostScript & PDF
Training, Development & Consulting
 
Thanks for the reply, I'm very new to writing PostScript and after a lot of searching and trying things I cannot work out how to do it, could you point me in the right direction?

TIA
 
You'll have to write a procedure. That procedure will process a string. For each word in the string, you will use the "stringwidth" operator to measure the word. You will add the x-dimension of the string to your "currentpoint". You will compare that with your margin. If the word would exceed the margin, you'll use a "moveto" to reposition your currentpoint to the start of a new line.

I would suggest that you study these operators:

currentpoint
moveto
stringwidth
search



Thomas D. Greer

Providing PostScript & PDF
Training, Development & Consulting
 
PostScript interpreter doesn't have any access to kerning pairs. So the sophisticated formatting is not possible. Try to do the formatting on the host.

PostScript is also about 100 times slower than C.

Your PostScript expert is just a click away.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top