🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.postscript
2 messages
2 total messages Started by Anthony J Stieber Tue, 16 Feb 1993 01:01
Saint Valentine's Day card in PostScript
#6674
Author: Anthony J Stieber
Date: Tue, 16 Feb 1993 01:01
158 lines
4690 bytes
Here's a Saint Valentine's Day card written in PostScript.  It uses the
ZapfDingbats font.  Given that Valentine's Day was yesterday it says
"Happy Belated Valentines [sic] Day!" on the cover.  It's perfect for
procrastinators like me.  There is also some sample text on the inside
that can be readily changed to your own heartfelt words.  I haven't
worked on this for months.  Feel free to add various features such as:

        add an "nonprocrastinator" flag for next year
        correct the punctuation errors
        color support (400 point heart looks better in red than black)
        clean up the ugly code
        fix heart&arrow code (synthesized arrow code is unused)
        easier to change cover and inside message
        automatic message justification
        premade messages
        more cover designs (N hearts vs one fixed position heart)
        script to take a mailing list and personalize each card

And probably other things I can't think of right now.  I hope this
posting restarts a trend in posting cards for various holidays.

Copyright 1992, Anthony Stieber, distributed under the Free Software
Foundation General Public License.

--------------apply sharp object here---------------------
%!PS
% a Valentines Day card

% Various useful PostScript code
% CAE Lab, 920213, Anthony Stieber

% some handy abbreviations
/sh { show } def
/ss { scalefont setfont } def
/cp {currentpoint} def
/TR /Times-Roman findfont def
/T-B /Times-Bold findfont def
/T-I /Times-Italic findfont def
/TB-I /Times-BoldItalic findfont def
/H /Helvetica findfont def
/H-BO /Helvetica-BoldOblique findfont def
/ZC-MI /ZapfChancery-MediumItalic findfont def
/ZD /ZapfDingbats findfont def
/P-I /Palatino-Italic findfont def
/S /Symbol findfont def
/topleft { 0  825 moveto } def

% an easy way to do things by inches
/in { 72 mul } def

% a little routine to center text
%    duplicatate the string, get its width, divide by two
%    then move to the left that amount
/cn { dup stringwidth pop 2 div neg 0 rmoveto } def

% procedures to move to the upperleft of the four portrait quandrants
/topleftQ { 0 825 moveto } def
/toprightQ { 315 825 moveto } def
/botleftQ { 0 412 moveto } def
/botrightQ { 315 412 moveto } def

%some code to rotate then shift into an upside down space.
/upsidedownpage { 180 rotate -600 -825 translate } def

%arrow pointing downwards, 20 points high and wide.
%to complement arrowtail
/arrowhead
{
			%head
	1 setlinewidth
	8 20 rlineto 
	-16 0 rlineto
	8 -20 rlineto
			%tail
			%move to behind head
	5 20 rmoveto
	0 20 rlineto
	-10 0 rlineto
	0 -20 rlineto
%	0 setgray fill
	stroke
} def
%a simple tail of an arrow, 20 points high and wide
%to complement arrowhead 
/arrowtail
{
			%right side of shaft
	1 setlinewidth
	10 0 rlineto
	0 20 rlineto
			%feather
	5 5 rlineto
	0 10 rlineto
	-10 -10 rlineto
			%start left feather
	-10 10 rlineto
	0 -10 rlineto
	5 -5 rlineto
			%start left side of shaft
	0 -20 rlineto
	10 0 rlineto
%	0 setgray fill
	stroke
} def




%the inside right of the card
botrightQ
%shift down and the right
ZC-MI 50 ss
135 -120 rmoveto currentpoint (Happy Belated) cn show
moveto 0 -55 rmoveto currentpoint (Valentines Day!) cn show

%vine and heart
moveto -90 -50 rmoveto cp ZD 15 ss (\246) show
H 10 ss			 ( Insert a nice message here or if you ) show
moveto 0 -15 rmoveto cp (don't feel creative, just leave it blank.) show
%vine and heart
ZD 15 ss (\246) show

TB-I 12 ss
moveto 20 -25 rmoveto cp (stick your name here) show

%now do the front of the card
upsidedownpage
botrightQ
5 -330 rmoveto
ZD 400 ss
% a heart
(\252)
show
% true charpath stroke
%(M) show

botrightQ
-25 -125 rmoveto
ZD 100 ss
% an angled arrow
(\364) show
%(\\) show
botrightQ
% 130 -290 rmoveto right on the line!
147 -265 rmoveto
% an angled arrow
(\364) show
%(\\) show

%the back of the card
botleftQ
75 -335 rmoveto currentpoint

P-I 10 ss (Copyright ) show
S 10 ss (\343) show P-I 10 ss ( 1992, Anthony Stieber) show
moveto 0 -15 rmoveto currentpoint
(anthony@csd4.csd.uwm.edu) show
showpage
Re: Saint Valentine's Day card in PostScript
#6675
Author: Tim Poston
Date: Thu, 18 Feb 1993 08:33
51 lines
1612 bytes
anthony@csd4.csd.uwm.edu (Anthony J Stieber) writes:
: Here's a Saint Valentine's Day card written in PostScript.



Try the following heart, rather than a font one:

%!
-130 100 translate
 1 .8 scale

0 1 40 {
40.0 div dup 2 sub mul neg setgray
newpath
300 120 moveto
400 300  0 740  400 660 curveto
800 900  600 250  300 120 curveto
fill
[.9 .03 -.02 .95 50 13] concat
} for

showpage

Easily adapted to fit your front page.

A nice personalising trick is first to fill the background
with black, then gray it with the recipient's name,
as in

1 setgray
20 0 translate
/Times-Italic findfont 20 scalefont setfont
-120 15 920 {           % for
dup -6 div exch moveto
0 1 12 {pop (Rebecca) show} for
} for

and _then_ draw the heart;
fewer iterations in the for loops with a bigger typeface,
longer name, or smaller space,
more for smaller/shorter/larger respectively.

With a colour printer,
try replacing the
  40.0 div dup 2 sub mul neg setgray
in the heart by (for instance)
  40.0 div dup 2 sub mul neg 0 0 setrgbcolor
or to your taste;
the possibilities alone are endless.

Tim
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads