🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #6196

Re: 0 0 moveto (+) show: how to center the (+)?

#6196
From: Stephen Woolston
Date: Mon, 03 Jun 1991 08:49
23 lines
1218 bytes
In article <9106020627.AA01346@einstein.physics.buffalo.edu>
xiaofei@EINSTEIN.PHYSICS.BUFFALO.EDU (X. F. Wang) writes:
>I need something
>
>x y moveto 
>( symbol ) show
>
>in drawing agraph. The probem is the symbol is not centered at
>currentpoint [The lower left corner is at currentpoint]. How do I
>symbol centered at currentpoint ?

Haven't tried it, but off the top of my head ...

	x y moveto
	(symbol) dup	% stack[ (symbol) (symbol) ]
	stringwidth	% stack[ (symbol) xwid ywid ]
	2 div neg	% stack[ (symbol) xwid -ywid/2 ]
	exch		% stack[ (symbol) -ywid/2 xwid ]
	2 div neg	% stack[ (symbol) -ywid/2 -xwid/2 ]
	exch		% stack[ (symbol) -xwid/2 -ywid/2 ]
	rmoveto show	% stack[ ]

You might like to define {dup ... show} as a procedure.
Technical Details
Message-ID: <1991Jun3.084911.20213@cs.nott.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!mcsun!ukc!warwick!nott-cs!swx
References: <9106020627.AA01346@einstein.physics.buffalo.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!mcsun!ukc!warwick!nott-cs!swx
From: swx@cs.nott.ac.uk (Stephen Woolston)
Newsgroups: comp.lang.postscript
Subject: Re: 0 0 moveto (+) show: how to center the (+)?
Message-ID: <1991Jun3.084911.20213@cs.nott.ac.uk>
Date: 3 Jun 91 08:49:11 GMT
References: <9106020627.AA01346@einstein.physics.buffalo.edu>
Organization: Nottingham University
Lines: 23