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!

Right aligning text 1

Status
Not open for further replies.

paulusharvey

Programmer
May 11, 2006
2
GB
Hi,

I have just started using postscript, and I am just struggling with something that I am sure is very simple (though very much not for me!!). I am creating a pricelist, and one of my columns needs to be right aligned.
I have managed to get the rest of the page working correctly, but just can't stop this column from overlapping the following one.

My (thouroughly incorrect I am sure) attempt at the function required is as follows, within the alignment of the text:
Code:
245 574.9 5.0 6.3 (blood pressure meter) s
			
/ra {dup stringwidth pop 98 sub } def
/r {ra s} def
			
	80.7 6.3 ( UA-767+ ) r
	100 6.3 (301-0568) s
	132.9 6.3 (35.79) s
	155 6.3 (S) s
	5.19 6.10 ti dofont
        166.9 6.3 (69.99) s	
	5.19 6.10 tr dofont
	
pop pop
Whereby I need to right align the column with UA-767 to the next column, with a space of 2 (hence the 98). The above code just breaks my Ghost script.

I would really appreciate any help that anyone could give me - I don't think that I am goign to have much hair left at this rate!!

I appreciate that this isn't much code, but didn't see a way of attaching to this message, and the ps file is a bit big to paste in of course. I can send a full file or anything really to anyone who can help though!

thanks in advance,

Paul
 
In the procedure "r", "ra" and "s" are called. You might want to check the operand stack after the "ra" procedure has executed. There might not be the correct number and/or order of objects on the stack for the "s" procedure.

Thanks
Scott Prouty
 
Thanks a lot SJProuty, I hadn't been considering the stack properly when I was trying to create the function (using a centering function that I had obtained) and so I had left too many objects on the stack for '/s' and not rolled them into the right place!

I'll know better for next time though!

Cheers,
Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top