%%% SHADE.tex or SHADE.sty
%%% Macros for use with font SHADE
%%% -------------------------------------------------------------------------
%%% Version 1 - March 21, 1993
%%% Peter Schmitt, Institute of Mathematics, University of Vienna
%%%                Strudlhofgasse 4, A-1090 Wien, Austria
%%%         e-mail A8131DAL@helios.edvz.univie.ac.at
%%%                schmitt@awirap.bitnet
%%% -------------------------------------------------------------------------

\catcode`\:11

\font\grey:=shade at 10truept

\newbox\shade:box
\newdimen\fill:boundary
    \setbox0=\hbox{\grey:\char0\relax}\fill:boundary=\ht0
\newcount\fill:level \newdimen\fill:size \newdimen\fill:goal

\long\def\shade#1{\leavevmode
             \setbox\shade:box=\hbox{#1}%
             \def\shade:column{}\def\shade:row{}%
             \fill:level=5 \fill:goal=\wd\shade:box
                \advance\fill:goal by 2\fill:boundary
             \let\shade:v\relax \Fill: \shade:row\shade:v
             \fill:level=5
             \fill:goal=\ht\shade:box \advance\fill:goal by \dp\shade:box
                \advance\fill:goal by 2\fill:boundary
             \let\shade:h\relax \Fill: \shade:column\shade:h
             \fill:goal=\ht\shade:box \advance\fill:goal by \dp\shade:box
             \setbox0=\vbox to\fill:goal{\offinterlineskip\grey:
                 \def\shade:h##1{%
                     \def\shade:v####1{\char####1##1\relax}%
                     \hbox to \wd\shade:box{\hss\shade:row\hss}}
                 \vss \shade:column \vss
                 }\ht0=\ht\shade:box \dp0=\dp\shade:box
             \rlap{\box0}\box\shade:box
            }
\def\Fill: {\setbox0=\hbox{\grey:\char\fill:level\relax}\fill:size=\ht0 
            \fill:}
\def\fill: #1#2{%
    \ifdim \fill:size>\fill:goal
           \advance\fill:level by-1
            \ifnum \fill:level>-1 \let \fill:next = \Fill:
                            \else \let \fill:next = \fill:stop \fi
     \else \edef#1{#1#2\the\fill:level}\advance\fill:goal by -\fill:size
           \let \fill:next = \fill:
      \fi \fill:next #1#2}
\def\fill:stop#1#2{}

\endinput
