[comp.lang.postscript] How to reverse Dingbats - a program

fyl@ssc.UUCP (Phil Hughes) (02/08/89)

A friend of mine asked me if I knew how to make a complement of the 
Zapf Dingbats font -- it only has hands and arrows that point in
one direction and she wanted the other direction as well.  I didn't
have an answer so she wrote one.  The following PostScript program
is that answer.  If you have suggestions or improvements she has
asked that you send them to her.  She is:
	{uw-beaver!tikal,uunet!pilchuck}!ssc!gasv!mac
---------------------------------------------------------------

Here is the PostScript program I did for making a
reverse dingbats font.  It was easy once I figured
out how the program I was copying from  Adobe's
cookbook worked.  The problem was that I was reading
Adobe's new book on PostScript programming (the green
book) and the cookbook examples do lots of things the
green book recommends against.  The style of my program
is a little funny because I was reading three different
books on programming at the time I wrote it.  But it
works.  I don't know if you have dingbats yet, but
maybe you know someone who would like this.

M McB

--------------------------------------------------------------------
%% dingreverse.pro
%% re-encode ZapfDingbats font to make ZapfDingbats-Reverse
%% Version 0.1
%% Date: 1-29-88
/BaseFontDict /ZapfDingbats findfont def
% Make NewMetrics dictionary with neg. x values
	/NewMetrics BaseFontDict /CharStrings get length dict def
	gsave
	nulldevice
	BaseFontDict 1 scalefont setfont
	/CharCount 0 def
	BaseFontDict /Encoding get
		{ % forall
			/CharName exch def
			CharName /.notdef ne
			{ % if
				/CharWidth 1 string dup 0
				CharCount put stringwidth pop 1000 mul neg def
				NewMetrics CharName CharWidth put
			} if
			/CharCount CharCount 1 add def
		} forall
	grestore
	NewMetrics

% Re-encode font backwards

/ReverseFontDict 12 dict def
ReverseFontDict begin

	/NewFontDict BaseFontDict maxlength 1 add dict def

	BaseFontDict
		{exch dup /FID ne
			{ dup /Encoding eq
			   { exch dup length array copy
				NewFontDict 3 1 roll put }
			   { exch NewFontDict 3 1 roll put }
			ifelse
			}
			{ pop pop }
		ifelse
	} forall
NewFontDict /FontName /ZapfDingbats-Reverse put
NewFontDict /FontMatrix [ -.001 0 0 .001 1 0] put
NewFontDict /Metrics NewMetrics put
/ZapfDingbats-Reverse NewFontDict definefont pop
end
% end of new font

/ZapfDingbats-Reverse findfont 14 scalefont setfont
200 100 moveto
(* + ~ . / 0 1 2 \335 \336 \337 \340 \341 \341 \343 \344 \351) show
/ZapfDingbats findfont 14 scalefont setfont
200 120 moveto
(* + ~ . / 0 1 2 \335 \336 \337 \340 \341 \341 \343 \344 \351) show
showpage


-- 
Phil Hughes, SSC, Inc. P.O. Box 55549, Seattle, WA 98155  (206)FOR-UNIX
    uw-beaver!tikal!ssc!fyl or uunet!pilchuck!ssc!fyl or attmail!ssc!fyl