🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.postscript.programming
Article #19

Re: Centering Text

#19
From: Johann__Myrkraverk__Oskarsson
Date: Fri, 23 Jan 2009 18:29
20 lines
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
Technical Details
Message-ID: <59b7a6d8.0@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!newshub.sdsu.edu!webcrossing
References: <59b7a6d8.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
From: Johann__Myrkraverk__Oskarsson@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.postscript.programming
Subject: Re: Centering Text
Message-ID: <59b7a6d8.0@webcrossing.la2eafNXanI>
Date: Fri, 23 Jan 2009 10:29:46 -0800
References: <59b7a6d8.-1@webcrossing.la2eafNXanI>
Lines: 21
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit