Skip to main content
Participant
January 23, 2009
Question

Centering Text

  • January 23, 2009
  • 1 reply
  • 2506 views
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
This topic has been closed for replies.

1 reply

Participant
January 23, 2009
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