cnc@hpcilzb.HP.COM (Chris Christensen) (01/19/89)
Does anyone have a sample of postscript function to fit a string to a box of a given size? What I want is for the string to start a new line before it goes outside of the box. I guess another way of saying this would be how can I fill text? Chris
cjc@ulysses.homer.nj.att.com (Chris Calabrese[mav]) (01/21/89)
In article <2200001@hpcilzb.HP.COM>, cnc@hpcilzb.HP.COM (Chris Christensen) writes: > Does anyone have a sample of postscript function to fit a string to a box > of a given size? What I want is for the string to start a new line before > it goes outside of the box. I guess another way of saying this would be > how can I fill text? This is in the Adobe Blue Book (Adobe Ssytems Incorporated, PostScript Language Tutorial And Cookbook, Addison-Wesley, 1985, ISBN 0-201-10179-3) Page 179 starts Program 12 / A Simple Line Breaking Algorithm, which give code for a procedure to break lines up to a given width and show them on the page. It could be easily modified for much more general use, I'm sure. Of course, this doesn't fill, but the basics are there. -- Name: Christopher J. Calabrese Brain loaned to: AT&T Bell Laboratories, Murray Hill, NJ att!ulysses!cjc cjc@ulysses.att.com Quote: ``I'm sure Henry Spencer will have a .signature on this soon.''
cnc@hpcilzb.HP.COM (Chris Christensen) (01/23/89)
>Of course, this doesn't fill, but the basics are there.
Thanks, that should do just fine!
rcd@ico.ISC.COM (Dick Dunn) (01/26/89)
In article <2200001@hpcilzb.HP.COM>, cnc@hpcilzb.HP.COM (Chris Christensen) writes: > Does anyone have a sample of postscript function to fit a string to a box > of a given size? What I want is for the string to start a new line before > it goes outside of the box... Someone already posted the reference to the Adobe-published example. However, it's probably worth an aside that if you're writing something that will see a lot of production use, you'd be better off doing the calculation in the host computer before you send it to the printer--not everything that *can* be done in PostScript *should* be done there. It can make a differ- ence in printing speed. -- Dick Dunn UUCP: {ncar,nbires}!ico!rcd (303)449-2870 ...A friend of the devil is a friend of mine.
les@chinet.chi.il.us (Leslie Mikesell) (01/27/89)
In article <13957@ico.ISC.COM> rcd@ico.ISC.COM (Dick Dunn) writes: >In article <2200001@hpcilzb.HP.COM>, cnc@hpcilzb.HP.COM (Chris Christensen) writes: >> Does anyone have a sample of postscript function to fit a string to a box >> of a given size? What I want is for the string to start a new line before >> it goes outside of the box.. >Someone already posted the reference to the Adobe-published example. >However, it's probably worth an aside that if you're writing something that >will see a lot of production use, you'd be better off doing the calculation >in the host computer before you send it to the printer--not everything that >*can* be done in PostScript *should* be done there. It can make a differ- >ence in printing speed. The problem with processing in the computer is that the computer has to know all the character sizes of every font that can be used. The printer has to know this in any case. Of course if the computer is going to attempt to give a screen preview then it has to have the font data for that. I recently needed to print nametags on a postscript printer and couldn't find any software that would take an arbitrary length string and make it fit into a fixed amount of space by scaling the font from a set maximum down to whatever it takes to make it fit. I ended up writing a perl script that would take a list of names and generate a postscript program. Is there a better way? Les Mikesell