Thread View: adobe.postscript.programming
3 messages
3 total messages
Started by Ted_Weimer
Fri, 23 Jan 2009 16:49
Centering Text
Author: Ted_Weimer
Date: Fri, 23 Jan 2009 16:49
Date: Fri, 23 Jan 2009 16:49
5 lines
946 bytes
946 bytes
Is there a way to code the line so it will center on the page without my recalculating the values (161.88 is the horizontal position of the moveto obviously) This particular line was origionally generated with Quark 3 and I use some moveto operators similar to this in my application. The vertical must be 410.05 as this text is 'envelope' sensitive. 161.88 410.05 m .5 5 24 175.25 (Certificate of Coverage)d Thanks TGW
Re: Centering Text
Author: Johann__Myrkraverk__Oskarsson
Date: Fri, 23 Jan 2009 18:29
Date: Fri, 23 Jan 2009 18:29
20 lines
872 bytes
872 bytes
Hi,
Here is a routine I have used to center text horizontally on a given x, y location:
/center { % x y string
/string exch def
/y exch def
/x exch def
0 0 moveto
string dup stringwidth pop
2 div
x exch sub
y moveto
show
} def
I hope this helps you,
Johann
Re: Centering Text
Author: Jeffrey H. Coffield
Date: Fri, 23 Jan 2009 19:38
Date: Fri, 23 Jan 2009 19:38
31 lines
1912 bytes
1912 bytes
Johann__Myrkraverk__Oskarsson@adobeforums.com wrote:
> Hi,
>
> Here is a routine I have used to center text horizontally on a given x, y location:
>
> /center { % x y string
> /string exch def
> /y exch def
> /x exch def
>
> 0 0 moveto
> string dup stringwidth pop
> 2 div
> x exch sub
> y moveto
> show
> } def
>
> I hope this helps you,
>
> Johann
How about this:
% string x y
/center {moveto dup stringwidth pop -2 div 0 rmoveto show} def
No side effects like redefining x, y and the postscript operator "string".
Jeff Coffield
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads