🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.ghostscript.bug
Article #62

random fonts

#62
From: Toby Howard
Date: Mon, 06 Apr 1992 17:23
114 lines
2939 bytes
The following 'random fonts' program (from The PostScript language journal
2/1) makes GhostScript 2.4 (3/25/92) blow up with:

Initializing... done.
Error: /undefinedresult in --mod--
Operand stack:
[]  1416878226  0
Execution stack:
%interp_exit    --nostringval--  --nostringval--  false  --nostringval--  --nostringval--  false  --nostringval--  --nostringval--  %finish_show  --nostringval--  --nostringval--  %show_continue  --nostringval--  --nostringval--  --nostringval--
Dictionary stack:
426/449  6/200  10/20  1/10
Ghostscript 2.4 (3/25/92)
   

---It prints OK though.

%!
/newfont 20 dict def
newfont begin
/FontType 3 def
/FontMatrix [ .001 0 0 .001 0 0] def
/FontBBox [0 0 1000 1000] def
/Encoding 256 array def
/str 1 string def
/tempdict 10 dict def

/numfont FontDirectory length def
/fontlist

FontDirectory
{	
	pop
	dup /Symbol eq
	{
	 pop /numfont numfont 1 sub def
	} if
	dup /ZapfDingbats eq
	{
	pop /numfont numfont 1 sub def
	} if
} forall

numfont array astore def

/BuildChar {
	exch begin
	tempdict begin
	   /c exch def
	   fontlist rand numfont mod get findfont 
		1000 scalefont setfont

	c 97 ge c 122 le rand 8 mod 0 eq and and
	{
	/c c 32 sub def 1 .75 scale
	} if
	c 65 ge c 90 le rand 8 mod 0 eq and and
	{
	/c c 32 add def 1 1.5 scale
	} if

	str 0 c put
	
	str stringwidth exch 200 add exch 
		setcharwidth

	c 32 ne
	{
	rand 18 mod 9 sub rotate
	rand 20 mod 90 add 100 div rand
		20 mod 90 add 100 div scale

	/x rand 80 mod 10 sub def
	/y rand 80 mod 40 sub def
	x y moveto str true charpath
		pathbbox newpath

	/ury exch 50 add def
	/urx exch 50 add def
	/lly exch 50 sub def
	/llx exch 50 sub def

	llx lly moveto
	llx ury lineto
	urx ury lineto
	urx lly lineto

	gsave
		1 setgray fill
	grestore

	closepath 0 setlinewidth stroke

	x y moveto str show
	} if
	end
   end
} def

end

/ransom newfont definefont pop

/ransom findfont 40 scalefont setfont
100 100 moveto (DIANETICS) show 

100 200 moveto  (GhostScript) show showpage
--

-----------------------------------------------------------------------
Toby Howard    Department of Computer Science, University of Manchester
Lecturer               Oxford Road, Manchester, M13 9PL, United Kingdom
                                                   Tel: +44 61-275-6274
toby@cs.man.ac.uk                                  Fax: +44 61-275-6236
-----------------------------------------------------------------------
Technical Details
Message-ID: <TOBY.92Apr6182343@r3h.cs.man.ac.uk>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cs.man.ac.UK!toby

Show Full Headers
Complete Article Headers
Newsgroups: gnu.ghostscript.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cs.man.ac.UK!toby
From: toby@cs.man.ac.UK (Toby Howard)
Subject: random fonts
Message-ID: <TOBY.92Apr6182343@r3h.cs.man.ac.uk>
Sender: gnulists@ai.mit.edu
Organization: Department of Computer Science, University of Manchester
Distribution: gnu
Date: Mon, 6 Apr 1992 17:23:43 GMT
Approved: bug-ghostscript@prep.ai.mit.edu
Lines: 115