Newsgroup: alt.sources


Newsgroups: alt.sources
Path: icdoc!dds
From: dds@doc.ic.ac.uk (Diomidis Spinellis)
Subject: Ransom note program (Postscript)
Message-ID: <1992Apr29.152806.26045@doc.ic.ac.uk>
Followup-To: alt.sources.d, comp.lang.postscript
Keywords: ransom note postscript font
Sender: usenet@doc.ic.ac.uk
Nntp-Posting-Host: dirty.doc.ic.ac.uk
Organization: Dept. of Computing, Imperial College, London, UK
Date: Wed, 29 Apr 1992 15:28:06 GMT
Lines: 206
Content-Length: 4688
Archive-name: ransom
Submitted-by: Diomidis Spinellis <dds@doc.ic.ac.uk>

This is a small postscript program you can use to create ransom notes.
Enter the text you want between the brackets at the beginning of the
script and send the whole file to a postscript printer.  The text will
be printed using many different fonts, sizes, orientations, and
styles.  You can modify the margins and the fonts used, by modifying
the source.

Have fun,

Diomidis

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	ransom.ps
# This archive created: Wed Apr 29 16:26:39 1992
export PATH; PATH=/bin:$PATH
echo shar: extracting "'ransom.ps'" '(2867 characters)'
if test -f 'ransom.ps'
then
	echo shar: will not over-write existing file "'ransom.ps'"
else
sed 's/^X//' << \SHAR_EOF > 'ransom.ps'
X%!PS-Adobe
X%
X% Ransom note writer.  Version 1.00
X%
X% (C) Copyright 1992 Diomidis Spinellis.  All rights reserved.
X% You can use and copy this program as long as the notice above
X% remains intact.  Modified copies must be clearly marked as such.
X% Send comments, threats, corrections etc. to dds@doc.ic.ac.uk
X%
X
X% Put here the ransom note you want
X% Use the | symbol to generate new lines.
X/note (Mr. Diomidis Spinellis|
XThis is a message from an international terrorist group.  
XWe have abducted your files and have hidden them away.
XYou must pay $500 by Sunday afternoon in order to see them again.  
XYou will receive further telephone instructions.
XDo not notify the police or any authorities; you will endager their life.|
XRemember: time flies!
X) def
X
X% Left margin position
X/left 30 def
X% Right margin position
X/right 510 def
X% Line advance
X/lineskip -40 def
X
X% Print the string
X% string ransom -
X/ransom {
X	{chr ransomchar}
X	forall
X} def
X
X% Convert a character code to a string
X% int chr string
X/chr {
X	( ) dup 0 3 index put exch pop
X} def
X
X% Draw a black filled box for the bounding box of the character
X% char box -
X/box {
X	gsave
X		gsave
X			true charpath pathbbox
X		grestore
X		1 add /ury exch def
X		1 add /urx exch def
X		1 sub /lly exch def
X		1 sub /llx exch def
X		newpath
X		llx lly moveto
X		urx lly lineto
X		urx ury lineto
X		llx ury lineto
X		closepath
X		0 setgray
X		fill
X	grestore
X} def
X
X% Display a single ransom character
X% character ransomchar -
X/ransomchar {
X	dup (|) eq {
X		pop
X		crlf
X	} {
X		randfont 20 random 30 add scalefont setfont
X		dup
X		gsave
X			5 random rotate
X			3 random 1 sub 3 random 1 sub rmoveto
X			dup ( ) eq {
X				[ {show} ]
X			} {
X			[
X				{ show }
X				{ show }
X				{ true charpath stroke }
X				{ true charpath 10 random 20 div setgray fill }
X				{ dup box 1 setgray show }
X			]
X			} ifelse
X			randarray exec
X		grestore
X		stringwidth
X		pop 0 rmoveto
X		format
X	} ifelse
X} def
X
X% Return a random value 0 <= r < int
X% int random int
X/random {
X	rand
X	exch
X	mod
X} def
X
X% Return a random element from the array
X% array randarray any
X/randarray {
X	dup
X	length
X	random
X	get
X} def
X
X% Return a random font
X% - randfont font
X/randfont {
X	[
X		/Times-Roman
X		/Times-Bold
X		/Times-Italic
X		/Times-BoldItalic
X		/Helvetica
X		/Helvetica-Bold
X		/Helevetica-Oblique
X		/Helevetica-BoldOblique
X		/Times-Roman
X		/Times-Bold
X		/Times-Italic
X		/Times-BoldItalic
X		/Helvetica
X		/Helvetica-Bold
X		/Helevetica-Oblique
X		/Helevetica-BoldOblique
X		/Courier
X		/Courier-Bold
X		/Courier-Oblique
X		/Courier-BoldOblique
X	]
X	randarray
X	findfont
X} def
X
X% Do a carriage return / line feed
X% - crlf -
X/crlf {
X	currentpoint exch pop
X	left exch moveto 0 lineskip rmoveto
X} def
X
X% Move to a new line if we are at the end of it
X% - format -
X/format {
X	currentpoint
X	pop
X	right gt
X	{crlf}
X	if
X} def
X
Xclear
Xerasepage
Xinitmatrix
Xleft 700 moveto
X.5 setlinewidth
Xnote ransom showpage
SHAR_EOF
if test 2867 -ne "`wc -c < 'ransom.ps'`"
then
	echo shar: error transmitting "'ransom.ps'" '(should have been 2867 characters)'
fi
fi # end of overwriting check
#	End of shell archive
exit 0

--
Diomidis Spinellis    Internet: <dds@doc.ic.ac.uk>    UUCP: ...!ukc!icdoc!dds
Department of Computing, Imperial College, London SW7     #include "/dev/tty"
-- 
Diomidis Spinellis    Internet: <dds@doc.ic.ac.uk>    UUCP: ...!ukc!icdoc!dds
Department of Computing, Imperial College, London SW7     #include "/dev/tty"



Newsgroup alt.sources contents
Newsgroup list
Diomidis Spinellis home page

Creative Commons License Unless otherwise expressly stated, all original material on this page created by Diomidis Spinellis is licensed under a Creative Commons Attribution-Share Alike 3.0 Greece License.