#!/bin/sh
#
# killeucfont
#
# 10/27/97 katayama@rd.nacsis.ac.jp
#

CMPFILE="/tmp/killcmpfont.$$"
EUCFILE="/tmp/killeucfont.$$"
trap "rm -f $CMPFILE $EUCFILE; exit 1" 0 1 2 15

cat > $CMPFILE <<'EOF'
%
% The operator `/compositefont' is disabled.
%
% 10/27/97 katayama@rd.nacsis.ac.jp
%
/compositefont {	% ASCIIFontName EUCFontName  compositefont  font'
    pop findfont 0 copyfont
} def
EOF

cat > $EUCFILE <<'EOF'
%
% The operator `/eucfont' is disabled.
%
% 10/27/97 katayama@rd.nacsis.ac.jp
%
/eucfont {
    pop findfont copyfont definefont pop
} def
EOF

sed -e "/^\/compositefont {/{
	    :loop1
	    s/^\(}[ 	][ 	]*def[ 	]*\)$/%\1/
	    t end1
	    s/^/%/
	    n
	    b loop1
	    :end1
	    r $CMPFILE
       }" \
    -e "/^\/eucfont {/{
	    :loop2
	    s/^\(}[ 	][ 	]*def\)$/%\1/
	    t end2
	    s/^/%/
	    n
	    b loop2
	    :end2
	    r $EUCFILE
        }" \
    -e "s/\(slantfont definefont pop\)$/pop pop pop %\1/"

exit 0
