[comp.lang.postscript] curveto heart wanted

milun@cs.Buffalo.EDU (Davin Milun) (04/06/89)

I'm looking for Postscript code which draws a heart shape (not a biological
one!). I assume that curveto's would be the easiest, or using arc's.

Thanx in advance.
Davin.
-------------------------------------------------------------------------------
Davin Milun    Internet:  milun@cs.Buffalo.EDU
               uucp:      ..!{boulder,decvax,rutgers}!sunybcs!milun
               BITNET:    milun@sunybcs.BITNET

greid@adobe.com (Glenn Reid) (04/06/89)

In article <5060@cs.Buffalo.EDU> milun@cs.Buffalo.EDU (Davin Milun) writes:
>I'm looking for Postscript code which draws a heart shape (not a biological
>one!). I assume that curveto's would be the easiest, or using arc's.

I wrote this program a long time ago (and it exemplefies a lot of bad
programming, so please don't flame me).  It is really a bumper sticker,
and I thought it would be entertaining to post the whole thing, but you
have to surgically remove the heart from the middle of the file
yourself (it's a very short program).

Cheers,
Glenn Reid
Adobe

%!
%  print a PostScript bumper sticker...

/LMargin 55 def
/in. {72 mul} def
90 rotate 0 -612 translate
/PTsize 150 def
/Times-Roman findfont PTsize scalefont setfont
LMargin 350 moveto
gsave
(PS  ) show
/saveobj save def
/showpage {} def
  340 310 translate
  1.8 1.8 scale
/heart {
	/height exch def
	currentpoint	/Y exch def	/X exch def
	/half height 2 div def
	half neg half rlineto
	half neg half
	 0 height
	  half half
	   rcurveto
	half half
	 height 0
	  half half neg
	   rcurveto
	closepath
} def
0 0 moveto
1 in. heart
.5 setgray
fill
showpage
saveobj restore

grestore
0 PTsize .9 mul neg rmoveto
({ honk } if) show

showpage

cplai@daisy.UUCP (Chung-Pang Lai) (04/07/89)

In article <5060@cs.Buffalo.EDU> milun@cs.Buffalo.EDU (Davin Milun) writes:
]I'm looking for Postscript code which draws a heart shape (not a biological
]one!). I assume that curveto's would be the easiest, or using arc's.
]

No need to reinvent the wheel.  Use the heart inside Symbol font.
Use charpath stroke if you just want the outline.

-- 
.signature under construction ...
{pyramid, osu-cis, uunet, killer}!daisy!cplai    C.P. Lai
cplai%daisy.UUCP@uunet.UU.NET   cplai%daisy@killer.DALLAS.TX.USA
Daisy Systems Corp, 700B Middlefield Road, Mtn View CA 94039.  (415)960-6961