Article View: comp.lang.postscript
Article #6204Re: 0 0 moveto (+) show: how to center the (+)?
From: X. F. Wang
Date: Tue, 04 Jun 1991 04:30
Date: Tue, 04 Jun 1991 04:30
37 lines
2218 bytes
2218 bytes
/* swx@cs.nott.ac.uk (Stephen Woolston) wrote */:
* 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.
Believe it or not, ywid is always 0. So (symbol) does not get vertically
centered. If it is (symbol), one can use charpath flattenpath pathbox
to get (symbol) vertically centered. However if it is a (string),
I pick up a letter, say (M), to calculate the height. But this is not a
perfect way of doing things. (abc) and (XYZ) do not have the same size
as (M). So the question is how to calculate (AbiTaRy) string height as
this? Or how to center an (aBItArY) string like this *vertically* ?
--
(___) | Xiaofei Wang | (___)
(o o) | Physics Department / 239 Fronczak Hall | (o o)
/-------\ / | State University of New York at {Buffalo} | \ /-------\
/ | ||O | {Buffalo}, New York 14260 | O|| | \
Technical Details
Message-ID:
<78801@eerie.acsu.Buffalo.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!csn!ub!acsu.buffalo.eduReferences:
<9106020627.AA01346@einstein.physics.buffalo.edu> <1991Jun3.084911.20213@cs.nott.ac.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!csn!ub!acsu.buffalo.edu From: xiaofei@acsu.buffalo.edu (X. F. Wang) Newsgroups: comp.lang.postscript Subject: Re: 0 0 moveto (+) show: how to center the (+)? Message-ID: <78801@eerie.acsu.Buffalo.EDU> Date: 4 Jun 91 04:30:03 GMT References: <9106020627.AA01346@einstein.physics.buffalo.edu> <1991Jun3.084911.20213@cs.nott.ac.uk> Sender: news@acsu.Buffalo.EDU Organization: SUNY Buffalo Lines: 37 Nntp-Posting-Host: autarch.acsu.buffalo.edu